diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 754043ee0ef770..534b1cea6242f8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -7,12 +7,12 @@ Summarize your PR. If it involves visual changes include a screenshot or gif. Delete any items that are not applicable to this PR. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md) -- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials -- [ ] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios +- [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials +- [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### For maintainers -- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process) +- [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) diff --git a/TYPESCRIPT.md b/TYPESCRIPT.md index 7be9a5e4f3b173..ae23768558f9dc 100644 --- a/TYPESCRIPT.md +++ b/TYPESCRIPT.md @@ -62,7 +62,7 @@ declare module '@elastic/eui' { 1. Open up the file and see how easy it would be to convert to TypeScript. 2. If it's very straightforward, go for it. 3. If it's not and you wish to stay focused on your own PR, get around the error by adding a type definition file in the same folder as the dependency, with the same name. -4. Minimally you will need to type what you are using in your PR. No need to go crazy to fully type the thing or you might be there for awhile depending on what's available. +4. Minimally you will need to type what you are using in your PR. No need to go crazy to fully type the thing or you might be there for a while depending on what's available. For example: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldlist.getall.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldlist.getall.md new file mode 100644 index 00000000000000..da29a4de9acc8f --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldlist.getall.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldList](./kibana-plugin-plugins-data-public.fieldlist.md) > [getAll](./kibana-plugin-plugins-data-public.fieldlist.getall.md) + +## FieldList.getAll property + +Signature: + +```typescript +readonly getAll: () => IndexPatternField[]; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldlist.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldlist.md index ef740575dff4ef..012b0694302903 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldlist.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldlist.md @@ -21,6 +21,7 @@ export declare class FieldList extends Array implements IInde | Property | Modifiers | Type | Description | | --- | --- | --- | --- | | [add](./kibana-plugin-plugins-data-public.fieldlist.add.md) | | (field: FieldSpec) => void | | +| [getAll](./kibana-plugin-plugins-data-public.fieldlist.getall.md) | | () => IndexPatternField[] | | | [getByName](./kibana-plugin-plugins-data-public.fieldlist.getbyname.md) | | (name: IndexPatternField['name']) => IndexPatternField | undefined | | | [getByType](./kibana-plugin-plugins-data-public.fieldlist.getbytype.md) | | (type: IndexPatternField['type']) => any[] | | | [remove](./kibana-plugin-plugins-data-public.fieldlist.remove.md) | | (field: IFieldType) => void | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getsearcherrortype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getsearcherrortype.md deleted file mode 100644 index b46728c0937925..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getsearcherrortype.md +++ /dev/null @@ -1,22 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [getSearchErrorType](./kibana-plugin-plugins-data-public.getsearcherrortype.md) - -## getSearchErrorType() function - -Signature: - -```typescript -export declare function getSearchErrorType({ message }: Pick): "UNSUPPORTED_QUERY" | undefined; -``` - -## Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| { message } | Pick<SearchError, 'message'> | | - -Returns: - -`"UNSUPPORTED_QUERY" | undefined` - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchresponse.ispartial.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchresponse.ispartial.md new file mode 100644 index 00000000000000..00a56c6fe9c31d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchresponse.ispartial.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IEsSearchResponse](./kibana-plugin-plugins-data-public.iessearchresponse.md) > [isPartial](./kibana-plugin-plugins-data-public.iessearchresponse.ispartial.md) + +## IEsSearchResponse.isPartial property + +Indicates whether the results returned are complete or partial + +Signature: + +```typescript +isPartial?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchresponse.isrunning.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchresponse.isrunning.md new file mode 100644 index 00000000000000..56fb1a7519811e --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchresponse.isrunning.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IEsSearchResponse](./kibana-plugin-plugins-data-public.iessearchresponse.md) > [isRunning](./kibana-plugin-plugins-data-public.iessearchresponse.isrunning.md) + +## IEsSearchResponse.isRunning property + +Indicates whether async search is still in flight + +Signature: + +```typescript +isRunning?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchresponse.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchresponse.md index ea7e2aef00d6ef..041d79de3282ec 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchresponse.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchresponse.md @@ -14,5 +14,7 @@ export interface IEsSearchResponse extends IKibanaSearchResponse | Property | Type | Description | | --- | --- | --- | +| [isPartial](./kibana-plugin-plugins-data-public.iessearchresponse.ispartial.md) | boolean | Indicates whether the results returned are complete or partial | +| [isRunning](./kibana-plugin-plugins-data-public.iessearchresponse.isrunning.md) | boolean | Indicates whether async search is still in flight | | [rawResponse](./kibana-plugin-plugins-data-public.iessearchresponse.rawresponse.md) | SearchResponse<any> | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpatternfieldlist.getall.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpatternfieldlist.getall.md new file mode 100644 index 00000000000000..070e36e303a807 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpatternfieldlist.getall.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IIndexPatternFieldList](./kibana-plugin-plugins-data-public.iindexpatternfieldlist.md) > [getAll](./kibana-plugin-plugins-data-public.iindexpatternfieldlist.getall.md) + +## IIndexPatternFieldList.getAll() method + +Signature: + +```typescript +getAll(): IndexPatternField[]; +``` +Returns: + +`IndexPatternField[]` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpatternfieldlist.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpatternfieldlist.md index 4ab012a2601d22..b068c4804c0ddd 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpatternfieldlist.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpatternfieldlist.md @@ -15,6 +15,7 @@ export interface IIndexPatternFieldList extends Array | Method | Description | | --- | --- | | [add(field)](./kibana-plugin-plugins-data-public.iindexpatternfieldlist.add.md) | | +| [getAll()](./kibana-plugin-plugins-data-public.iindexpatternfieldlist.getall.md) | | | [getByName(name)](./kibana-plugin-plugins-data-public.iindexpatternfieldlist.getbyname.md) | | | [getByType(type)](./kibana-plugin-plugins-data-public.iindexpatternfieldlist.getbytype.md) | | | [remove(field)](./kibana-plugin-plugins-data-public.iindexpatternfieldlist.remove.md) | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchgeneric.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchgeneric.md index cdf19cd15a298a..3bd6a398c8df54 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchgeneric.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchgeneric.md @@ -7,5 +7,5 @@ Signature: ```typescript -export declare type ISearchGeneric = (request: IEsSearchRequest, options?: IStrategyOptions) => Observable; +export declare type ISearchGeneric = (request: IEsSearchRequest, options?: ISearchOptions) => Observable; ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.md index 05b72526062896..3eb38dc7d52e08 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.md @@ -15,4 +15,5 @@ export interface ISearchOptions | Property | Type | Description | | --- | --- | --- | | [signal](./kibana-plugin-plugins-data-public.isearchoptions.signal.md) | AbortSignal | | +| [strategy](./kibana-plugin-plugins-data-public.isearchoptions.strategy.md) | string | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.strategy.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.strategy.md new file mode 100644 index 00000000000000..df7e050691a8f3 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.strategy.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ISearchOptions](./kibana-plugin-plugins-data-public.isearchoptions.md) > [strategy](./kibana-plugin-plugins-data-public.isearchoptions.strategy.md) + +## ISearchOptions.strategy property + +Signature: + +```typescript +strategy?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md index c8d45804a37294..53c30b52cb9850 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md @@ -18,7 +18,6 @@ | [OptionedParamType](./kibana-plugin-plugins-data-public.optionedparamtype.md) | | | [Plugin](./kibana-plugin-plugins-data-public.plugin.md) | | | [RequestTimeoutError](./kibana-plugin-plugins-data-public.requesttimeouterror.md) | Class used to signify that a request timed out. Useful for applications to conditionally handle this type of error differently than other errors. | -| [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) | | | [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) | | | [TimeHistory](./kibana-plugin-plugins-data-public.timehistory.md) | | @@ -39,7 +38,6 @@ | --- | --- | | [getDefaultQuery(language)](./kibana-plugin-plugins-data-public.getdefaultquery.md) | | | [getEsPreference(uiSettings, sessionId)](./kibana-plugin-plugins-data-public.getespreference.md) | | -| [getSearchErrorType({ message })](./kibana-plugin-plugins-data-public.getsearcherrortype.md) | | | [getSearchParamsFromRequest(searchRequest, dependencies)](./kibana-plugin-plugins-data-public.getsearchparamsfromrequest.md) | | | [getTime(indexPattern, timeRange, options)](./kibana-plugin-plugins-data-public.gettime.md) | | | [plugin(initializerContext)](./kibana-plugin-plugins-data-public.plugin.md) | | @@ -80,6 +78,7 @@ | [RefreshInterval](./kibana-plugin-plugins-data-public.refreshinterval.md) | | | [SavedQuery](./kibana-plugin-plugins-data-public.savedquery.md) | | | [SavedQueryService](./kibana-plugin-plugins-data-public.savedqueryservice.md) | | +| [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) | | | [SearchInterceptorDeps](./kibana-plugin-plugins-data-public.searchinterceptordeps.md) | | | [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) | | | [TabbedAggColumn](./kibana-plugin-plugins-data-public.tabbedaggcolumn.md) | \* | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror._constructor_.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror._constructor_.md deleted file mode 100644 index 4d7691d24a79d4..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror._constructor_.md +++ /dev/null @@ -1,20 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) > [(constructor)](./kibana-plugin-plugins-data-public.searcherror._constructor_.md) - -## SearchError.(constructor) - -Constructs a new instance of the `SearchError` class - -Signature: - -```typescript -constructor({ status, title, message, path, type }: SearchErrorOptions); -``` - -## Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| { status, title, message, path, type } | SearchErrorOptions | | - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.md index 06e60cadf4a852..65b46bf6cba4de 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.md @@ -2,28 +2,22 @@ [Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) -## SearchError class +## SearchError interface Signature: ```typescript -export declare class SearchError extends Error +export interface SearchError ``` -## Constructors - -| Constructor | Modifiers | Description | -| --- | --- | --- | -| [(constructor)({ status, title, message, path, type })](./kibana-plugin-plugins-data-public.searcherror._constructor_.md) | | Constructs a new instance of the SearchError class | - ## Properties -| Property | Modifiers | Type | Description | -| --- | --- | --- | --- | -| [message](./kibana-plugin-plugins-data-public.searcherror.message.md) | | string | | -| [name](./kibana-plugin-plugins-data-public.searcherror.name.md) | | string | | -| [path](./kibana-plugin-plugins-data-public.searcherror.path.md) | | string | | -| [status](./kibana-plugin-plugins-data-public.searcherror.status.md) | | string | | -| [title](./kibana-plugin-plugins-data-public.searcherror.title.md) | | string | | -| [type](./kibana-plugin-plugins-data-public.searcherror.type.md) | | string | | +| Property | Type | Description | +| --- | --- | --- | +| [message](./kibana-plugin-plugins-data-public.searcherror.message.md) | string | | +| [name](./kibana-plugin-plugins-data-public.searcherror.name.md) | string | | +| [path](./kibana-plugin-plugins-data-public.searcherror.path.md) | string | | +| [status](./kibana-plugin-plugins-data-public.searcherror.status.md) | string | | +| [title](./kibana-plugin-plugins-data-public.searcherror.title.md) | string | | +| [type](./kibana-plugin-plugins-data-public.searcherror.type.md) | string | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.md index 30e980b5ffc544..b3b7da05326d06 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.md @@ -35,7 +35,7 @@ export declare class SearchInterceptor | Method | Modifiers | Description | | --- | --- | --- | -| [runSearch(request, signal)](./kibana-plugin-plugins-data-public.searchinterceptor.runsearch.md) | | | +| [runSearch(request, signal, strategy)](./kibana-plugin-plugins-data-public.searchinterceptor.runsearch.md) | | | | [search(request, options)](./kibana-plugin-plugins-data-public.searchinterceptor.search.md) | | Searches using the given search method. Overrides the AbortSignal with one that will abort either when cancelPending is called, when the request times out, or when the original AbortSignal is aborted. Updates the pendingCount when the request is started/finalized. | | [setupTimers(options)](./kibana-plugin-plugins-data-public.searchinterceptor.setuptimers.md) | | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.runsearch.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.runsearch.md index 3601a00c48cf31..ad1d1dcb59d7b8 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.runsearch.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.runsearch.md @@ -7,7 +7,7 @@ Signature: ```typescript -protected runSearch(request: IEsSearchRequest, signal: AbortSignal): Observable; +protected runSearch(request: IEsSearchRequest, signal: AbortSignal, strategy?: string): Observable; ``` ## Parameters @@ -16,6 +16,7 @@ protected runSearch(request: IEsSearchRequest, signal: AbortSignal): Observable< | --- | --- | --- | | request | IEsSearchRequest | | | signal | AbortSignal | | +| strategy | string | | Returns: diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchrequest.indextype.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchrequest.indextype.md new file mode 100644 index 00000000000000..aaf4e55ee007b4 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchrequest.indextype.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IEsSearchRequest](./kibana-plugin-plugins-data-server.iessearchrequest.md) > [indexType](./kibana-plugin-plugins-data-server.iessearchrequest.indextype.md) + +## IEsSearchRequest.indexType property + +Signature: + +```typescript +indexType?: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchrequest.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchrequest.md new file mode 100644 index 00000000000000..0dfa23eb64c1b2 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchrequest.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IEsSearchRequest](./kibana-plugin-plugins-data-server.iessearchrequest.md) + +## IEsSearchRequest interface + +Signature: + +```typescript +export interface IEsSearchRequest extends IKibanaSearchRequest +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [indexType](./kibana-plugin-plugins-data-server.iessearchrequest.indextype.md) | string | | +| [params](./kibana-plugin-plugins-data-server.iessearchrequest.params.md) | ISearchRequestParams | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchrequest.params.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchrequest.params.md new file mode 100644 index 00000000000000..d65281973c951f --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchrequest.params.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IEsSearchRequest](./kibana-plugin-plugins-data-server.iessearchrequest.md) > [params](./kibana-plugin-plugins-data-server.iessearchrequest.params.md) + +## IEsSearchRequest.params property + +Signature: + +```typescript +params?: ISearchRequestParams; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchresponse.ispartial.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchresponse.ispartial.md new file mode 100644 index 00000000000000..fbddfc1cd9fc40 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchresponse.ispartial.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IEsSearchResponse](./kibana-plugin-plugins-data-server.iessearchresponse.md) > [isPartial](./kibana-plugin-plugins-data-server.iessearchresponse.ispartial.md) + +## IEsSearchResponse.isPartial property + +Indicates whether the results returned are complete or partial + +Signature: + +```typescript +isPartial?: boolean; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchresponse.isrunning.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchresponse.isrunning.md new file mode 100644 index 00000000000000..01f3982957d5c3 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchresponse.isrunning.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IEsSearchResponse](./kibana-plugin-plugins-data-server.iessearchresponse.md) > [isRunning](./kibana-plugin-plugins-data-server.iessearchresponse.isrunning.md) + +## IEsSearchResponse.isRunning property + +Indicates whether async search is still in flight + +Signature: + +```typescript +isRunning?: boolean; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchresponse.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchresponse.md new file mode 100644 index 00000000000000..0407dce5fe4181 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchresponse.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IEsSearchResponse](./kibana-plugin-plugins-data-server.iessearchresponse.md) + +## IEsSearchResponse interface + +Signature: + +```typescript +export interface IEsSearchResponse extends IKibanaSearchResponse +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [isPartial](./kibana-plugin-plugins-data-server.iessearchresponse.ispartial.md) | boolean | Indicates whether the results returned are complete or partial | +| [isRunning](./kibana-plugin-plugins-data-server.iessearchresponse.isrunning.md) | boolean | Indicates whether async search is still in flight | +| [rawResponse](./kibana-plugin-plugins-data-server.iessearchresponse.rawresponse.md) | SearchResponse<any> | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchresponse.rawresponse.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchresponse.rawresponse.md new file mode 100644 index 00000000000000..0ee1691d0f697c --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchresponse.rawresponse.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IEsSearchResponse](./kibana-plugin-plugins-data-server.iessearchresponse.md) > [rawResponse](./kibana-plugin-plugins-data-server.iessearchresponse.rawresponse.md) + +## IEsSearchResponse.rawResponse property + +Signature: + +```typescript +rawResponse: SearchResponse; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md index 1bcd575803f880..f472064c877555 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md @@ -36,6 +36,8 @@ | [EsQueryConfig](./kibana-plugin-plugins-data-server.esqueryconfig.md) | | | [FieldFormatConfig](./kibana-plugin-plugins-data-server.fieldformatconfig.md) | | | [Filter](./kibana-plugin-plugins-data-server.filter.md) | | +| [IEsSearchRequest](./kibana-plugin-plugins-data-server.iessearchrequest.md) | | +| [IEsSearchResponse](./kibana-plugin-plugins-data-server.iessearchresponse.md) | | | [IFieldSubType](./kibana-plugin-plugins-data-server.ifieldsubtype.md) | | | [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) | | | [IIndexPattern](./kibana-plugin-plugins-data-server.iindexpattern.md) | | diff --git a/docs/user/visualize.asciidoc b/docs/user/visualize.asciidoc index 6919b5a8772eff..dc116962f9e961 100644 --- a/docs/user/visualize.asciidoc +++ b/docs/user/visualize.asciidoc @@ -132,6 +132,7 @@ include::{kib-repo-dir}/visualize/lens.asciidoc[] include::{kib-repo-dir}/visualize/most-frequent.asciidoc[] include::{kib-repo-dir}/visualize/tsvb.asciidoc[] + include::{kib-repo-dir}/visualize/timelion.asciidoc[] include::{kib-repo-dir}/visualize/tilemap.asciidoc[] diff --git a/docs/visualize/images/timelion-add-to-dashboard.png b/docs/visualize/images/timelion-add-to-dashboard.png new file mode 100644 index 00000000000000..a0ccc0af735a80 Binary files /dev/null and b/docs/visualize/images/timelion-add-to-dashboard.png differ diff --git a/docs/visualize/images/timelion-app.png b/docs/visualize/images/timelion-app.png new file mode 100644 index 00000000000000..236f9f2d41808b Binary files /dev/null and b/docs/visualize/images/timelion-app.png differ diff --git a/docs/visualize/images/timelion-copy-expression.png b/docs/visualize/images/timelion-copy-expression.png new file mode 100644 index 00000000000000..376bf7919166e2 Binary files /dev/null and b/docs/visualize/images/timelion-copy-expression.png differ diff --git a/docs/visualize/images/timelion-create-new-dashboard.png b/docs/visualize/images/timelion-create-new-dashboard.png new file mode 100644 index 00000000000000..4049b6d77cca67 Binary files /dev/null and b/docs/visualize/images/timelion-create-new-dashboard.png differ diff --git a/docs/visualize/images/timelion-dashboard.png b/docs/visualize/images/timelion-dashboard.png new file mode 100644 index 00000000000000..e217dca98d0792 Binary files /dev/null and b/docs/visualize/images/timelion-dashboard.png differ diff --git a/docs/visualize/images/timelion-vis-paste-expression.png b/docs/visualize/images/timelion-vis-paste-expression.png new file mode 100644 index 00000000000000..86e175e40815bf Binary files /dev/null and b/docs/visualize/images/timelion-vis-paste-expression.png differ diff --git a/docs/visualize/timelion.asciidoc b/docs/visualize/timelion.asciidoc index 9e41cce561454b..4869664fab0a4b 100644 --- a/docs/visualize/timelion.asciidoc +++ b/docs/visualize/timelion.asciidoc @@ -504,3 +504,44 @@ image::images/timelion-conditional04.png[] {nbsp} For additional information on Timelion conditional capabilities, go to https://www.elastic.co/blog/timeseries-if-then-else-with-timelion[I have but one .condition()]. + +[float] +[[timelion-deprecation]] +=== Timelion App deprecation + +Deprecated since 7.0, the Timelion app will be removed in 8.0. If you have any Timelion worksheets, you must migrate them to a dashboard. + +NOTE: Only the Timelion app is deprecated. {kib} continues to support Timelion visualizations on dashboards, in Visualize, and in Canvas. + +[float] +[[timelion-app-to-vis]] +==== Create a dashboard from a Timelion worksheet + +To replace a Timelion worksheet with a dashboard, follow the same process for adding a visualization. +In addition, you must migrate the Timelion graphs to Visualize. + +. Open the menu, click **Dashboard**, then click **Create dashboard**. + +. On the dashboard, click **Create New**, then select the Timelion visualization. ++ +[role="screenshot"] +image::images/timelion-create-new-dashboard.png[] ++ +The only thing you need is the Timelion expression for each graph. + +. Open the Timelion app on a new tab, select the chart you want to copy, and copy its expression. ++ +[role="screenshot"] +image::images/timelion-copy-expression.png[] + +. Return to the other tab and paste the copied expression to the *Timelion Expression* field and click **Update**. ++ +[role="screenshot"] +image::images/timelion-vis-paste-expression.png[] + +. Save the new visualization, give it a name, and click **Save and Return**. ++ +Your Timelion visualization will appear on the dashboard. Repeat this for all your charts on each worksheet. ++ +[role="screenshot"] +image::images/timelion-dashboard.png[] diff --git a/examples/search_examples/README.md b/examples/search_examples/README.md new file mode 100644 index 00000000000000..bcc17bf7f33338 --- /dev/null +++ b/examples/search_examples/README.md @@ -0,0 +1,9 @@ +# search_examples + +> An awesome Kibana plugin + +--- + +## Development + +See the [kibana contributing guide](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md) for instructions setting up your development environment. diff --git a/examples/search_examples/common/index.ts b/examples/search_examples/common/index.ts new file mode 100644 index 00000000000000..e1e7f6389ae831 --- /dev/null +++ b/examples/search_examples/common/index.ts @@ -0,0 +1,32 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { IEsSearchResponse, IEsSearchRequest } from '../../../src/plugins/data/common'; + +export const PLUGIN_ID = 'searchExamples'; +export const PLUGIN_NAME = 'Search Examples'; + +export interface IMyStrategyRequest extends IEsSearchRequest { + get_cool: boolean; +} +export interface IMyStrategyResponse extends IEsSearchResponse { + cool: string; +} + +export const SERVER_SEARCH_ROUTE_PATH = '/api/examples/search'; diff --git a/examples/search_examples/kibana.json b/examples/search_examples/kibana.json new file mode 100644 index 00000000000000..7e392b84173607 --- /dev/null +++ b/examples/search_examples/kibana.json @@ -0,0 +1,9 @@ +{ + "id": "searchExamples", + "version": "8.0.0", + "server": true, + "ui": true, + "requiredPlugins": ["navigation", "data", "developerExamples"], + "optionalPlugins": [], + "requiredBundles": [] +} diff --git a/examples/search_examples/public/application.tsx b/examples/search_examples/public/application.tsx new file mode 100644 index 00000000000000..81e4ee8514c11f --- /dev/null +++ b/examples/search_examples/public/application.tsx @@ -0,0 +1,44 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React from 'react'; +import ReactDOM from 'react-dom'; +import { AppMountParameters, CoreStart } from '../../../src/core/public'; +import { AppPluginStartDependencies } from './types'; +import { SearchExamplesApp } from './components/app'; + +export const renderApp = ( + { notifications, savedObjects, http }: CoreStart, + { navigation, data }: AppPluginStartDependencies, + { appBasePath, element }: AppMountParameters +) => { + ReactDOM.render( + , + element + ); + + return () => ReactDOM.unmountComponentAtNode(element); +}; diff --git a/examples/search_examples/public/components/app.tsx b/examples/search_examples/public/components/app.tsx new file mode 100644 index 00000000000000..31cc5e420da11b --- /dev/null +++ b/examples/search_examples/public/components/app.tsx @@ -0,0 +1,341 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React, { useState, useEffect } from 'react'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; +import { BrowserRouter as Router } from 'react-router-dom'; + +import { + EuiButton, + EuiPage, + EuiPageBody, + EuiPageContent, + EuiPageContentBody, + EuiPageHeader, + EuiTitle, + EuiText, + EuiFlexGrid, + EuiFlexItem, + EuiCheckbox, + EuiSpacer, + EuiCode, + EuiComboBox, + EuiFormLabel, +} from '@elastic/eui'; + +import { CoreStart } from '../../../../src/core/public'; +import { mountReactNode } from '../../../../src/core/public/utils'; +import { NavigationPublicPluginStart } from '../../../../src/plugins/navigation/public'; + +import { + PLUGIN_ID, + PLUGIN_NAME, + IMyStrategyRequest, + IMyStrategyResponse, + SERVER_SEARCH_ROUTE_PATH, +} from '../../common'; + +import { + DataPublicPluginStart, + IndexPatternSelect, + IndexPattern, + IndexPatternField, +} from '../../../../src/plugins/data/public'; + +interface SearchExamplesAppDeps { + basename: string; + notifications: CoreStart['notifications']; + http: CoreStart['http']; + savedObjectsClient: CoreStart['savedObjects']['client']; + navigation: NavigationPublicPluginStart; + data: DataPublicPluginStart; +} + +function formatFieldToComboBox(field?: IndexPatternField | null) { + if (!field) return []; + return formatFieldsToComboBox([field]); +} + +function formatFieldsToComboBox(fields?: IndexPatternField[]) { + if (!fields) return []; + + return fields?.map((field) => { + return { + label: field.displayName || field.name, + }; + }); +} + +export const SearchExamplesApp = ({ + http, + basename, + notifications, + savedObjectsClient, + navigation, + data, +}: SearchExamplesAppDeps) => { + const [getCool, setGetCool] = useState(false); + const [timeTook, setTimeTook] = useState(); + const [indexPattern, setIndexPattern] = useState(); + const [numericFields, setNumericFields] = useState(); + const [selectedField, setSelectedField] = useState(); + + // Fetch the default index pattern using the `data.indexPatterns` service, as the component is mounted. + useEffect(() => { + const setDefaultIndexPattern = async () => { + const defaultIndexPattern = await data.indexPatterns.getDefault(); + setIndexPattern(defaultIndexPattern); + }; + + setDefaultIndexPattern(); + }, [data]); + + // Update the fields list every time the index pattern is modified. + useEffect(() => { + const fields = indexPattern?.fields.filter( + (field) => field.type === 'number' && field.aggregatable + ); + setNumericFields(fields); + setSelectedField(fields?.length ? fields[0] : null); + }, [indexPattern]); + + const doAsyncSearch = async (strategy?: string) => { + if (!indexPattern || !selectedField) return; + + // Constuct the query portion of the search request + const query = data.query.getEsQuery(indexPattern); + + // Constuct the aggregations portion of the search request by using the `data.search.aggs` service. + const aggs = [{ type: 'avg', params: { field: selectedField.name } }]; + const aggsDsl = data.search.aggs.createAggConfigs(indexPattern, aggs).toDsl(); + + const request = { + params: { + index: indexPattern.title, + body: { + aggs: aggsDsl, + query, + }, + }, + }; + + if (strategy) { + // Add a custom request parameter to be consumed by `MyStrategy`. + (request as IMyStrategyRequest).get_cool = getCool; + } + + // Submit the search request using the `data.search` service. + const searchSubscription$ = data.search + .search(request, { + strategy, + }) + .subscribe({ + next: (response) => { + if (!response.isPartial && !response.isRunning) { + setTimeTook(response.rawResponse.took); + const avgResult: number | undefined = response.rawResponse.aggregations + ? response.rawResponse.aggregations[1].value + : undefined; + const message = ( + + Searched {response.rawResponse.hits.total} documents.
+ The average of {selectedField.name} is {avgResult ? Math.floor(avgResult) : 0}. +
+ Is it Cool? {String((response as IMyStrategyResponse).cool)} +
+ ); + notifications.toasts.addSuccess({ + title: 'Query result', + text: mountReactNode(message), + }); + searchSubscription$.unsubscribe(); + } else if (response.isPartial && !response.isRunning) { + // TODO: Make response error status clearer + notifications.toasts.addWarning('An error has occurred'); + searchSubscription$.unsubscribe(); + } + }, + error: () => { + notifications.toasts.addDanger('Failed to run search'); + }, + }); + }; + + const onClickHandler = () => { + doAsyncSearch(); + }; + + const onMyStrategyClickHandler = () => { + doAsyncSearch('myStrategy'); + }; + + const onServerClickHandler = async () => { + if (!indexPattern || !selectedField) return; + try { + const response = await http.get(SERVER_SEARCH_ROUTE_PATH, { + query: { + index: indexPattern.title, + field: selectedField.name, + }, + }); + + notifications.toasts.addSuccess(`Server returned ${JSON.stringify(response)}`); + } catch (e) { + notifications.toasts.addDanger('Failed to run search'); + } + }; + + if (!indexPattern) return null; + + return ( + + + <> + + + + + +

+ +

+
+
+ + + + + + Index Pattern + { + const newIndexPattern = await data.indexPatterns.get(newIndexPatternId); + setIndexPattern(newIndexPattern); + }} + isClearable={false} + /> + + + Numeric Fields + { + const field = indexPattern.getFieldByName(option[0].label); + setSelectedField(field || null); + }} + sortMatchesBy="startsWith" + /> + + + + + + + + +

+ Searching Elasticsearch using data.search +

+
+ + If you want to fetch data from Elasticsearch, you can use the different services + provided by the data plugin. These help you get the index + pattern and search bar configuration, format them into a DSL query and send it + to Elasticsearch. + + + + + + + +

Writing a custom search strategy

+
+ + If you want to do some pre or post processing on the server, you might want to + create a custom search strategy. This example uses such a strategy, passing in + custom input and receiving custom output back. + + + } + checked={getCool} + onChange={(event) => setGetCool(event.target.checked)} + /> + + + + + + +

Using search on the server

+
+ + You can also run your search request from the server, without registering a + search strategy. This request does not take the configuration of{' '} + TopNavMenu into account, but you could pass those down to the + server as well. + + + + +
+
+
+
+ +
+
+ ); +}; diff --git a/examples/search_examples/public/index.scss b/examples/search_examples/public/index.scss new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/examples/search_examples/public/index.ts b/examples/search_examples/public/index.ts new file mode 100644 index 00000000000000..cd3208aa0c0884 --- /dev/null +++ b/examples/search_examples/public/index.ts @@ -0,0 +1,29 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import './index.scss'; + +import { SearchExamplesPlugin } from './plugin'; + +// This exports static code and TypeScript types, +// as well as, Kibana Platform `plugin()` initializer. +export function plugin() { + return new SearchExamplesPlugin(); +} +export { SearchExamplesPluginSetup, SearchExamplesPluginStart } from './types'; diff --git a/examples/search_examples/public/plugin.ts b/examples/search_examples/public/plugin.ts new file mode 100644 index 00000000000000..436304e9d5ff61 --- /dev/null +++ b/examples/search_examples/public/plugin.ts @@ -0,0 +1,76 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { + AppMountParameters, + CoreSetup, + CoreStart, + Plugin, + AppNavLinkStatus, +} from '../../../src/core/public'; +import { + SearchExamplesPluginSetup, + SearchExamplesPluginStart, + AppPluginSetupDependencies, + AppPluginStartDependencies, +} from './types'; +import { PLUGIN_NAME } from '../common'; + +export class SearchExamplesPlugin + implements + Plugin< + SearchExamplesPluginSetup, + SearchExamplesPluginStart, + AppPluginSetupDependencies, + AppPluginStartDependencies + > { + public setup( + core: CoreSetup, + { developerExamples }: AppPluginSetupDependencies + ): SearchExamplesPluginSetup { + // Register an application into the side navigation menu + core.application.register({ + id: 'searchExamples', + title: PLUGIN_NAME, + navLinkStatus: AppNavLinkStatus.hidden, + async mount(params: AppMountParameters) { + // Load application bundle + const { renderApp } = await import('./application'); + // Get start services as specified in kibana.json + const [coreStart, depsStart] = await core.getStartServices(); + // Render the application + return renderApp(coreStart, depsStart, params); + }, + }); + + developerExamples.register({ + appId: 'searchExamples', + title: 'Search Examples', + description: `Search Examples`, + }); + + return {}; + } + + public start(core: CoreStart): SearchExamplesPluginStart { + return {}; + } + + public stop() {} +} diff --git a/examples/search_examples/public/types.ts b/examples/search_examples/public/types.ts new file mode 100644 index 00000000000000..0670cc5907449c --- /dev/null +++ b/examples/search_examples/public/types.ts @@ -0,0 +1,36 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { NavigationPublicPluginStart } from '../../../src/plugins/navigation/public'; +import { DataPublicPluginStart } from '../../../src/plugins/data/public'; +import { DeveloperExamplesSetup } from '../../developer_examples/public'; + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface SearchExamplesPluginSetup {} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface SearchExamplesPluginStart {} + +export interface AppPluginSetupDependencies { + developerExamples: DeveloperExamplesSetup; +} + +export interface AppPluginStartDependencies { + navigation: NavigationPublicPluginStart; + data: DataPublicPluginStart; +} diff --git a/examples/search_examples/server/index.ts b/examples/search_examples/server/index.ts new file mode 100644 index 00000000000000..06d41490af57ac --- /dev/null +++ b/examples/search_examples/server/index.ts @@ -0,0 +1,27 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { PluginInitializerContext } from '../../../src/core/server'; +import { SearchExamplesPlugin } from './plugin'; + +export function plugin(initializerContext: PluginInitializerContext) { + return new SearchExamplesPlugin(initializerContext); +} + +export { SearchExamplesPluginSetup, SearchExamplesPluginStart } from './types'; diff --git a/examples/search_examples/server/my_strategy.ts b/examples/search_examples/server/my_strategy.ts new file mode 100644 index 00000000000000..a1116ddbd759b9 --- /dev/null +++ b/examples/search_examples/server/my_strategy.ts @@ -0,0 +1,40 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { ISearchStrategy, PluginStart } from '../../../src/plugins/data/server'; +import { IMyStrategyResponse, IMyStrategyRequest } from '../common'; + +export const mySearchStrategyProvider = (data: PluginStart): ISearchStrategy => { + const es = data.search.getSearchStrategy('es'); + return { + search: async (context, request, options): Promise => { + request.debug = true; + const esSearchRes = await es.search(context, request, options); + return { + ...esSearchRes, + cool: (request as IMyStrategyRequest).get_cool ? 'YES' : 'NOPE', + }; + }, + cancel: async (context, id) => { + if (es.cancel) { + es.cancel(context, id); + } + }, + }; +}; diff --git a/examples/search_examples/server/plugin.ts b/examples/search_examples/server/plugin.ts new file mode 100644 index 00000000000000..deef5a53b2b731 --- /dev/null +++ b/examples/search_examples/server/plugin.ts @@ -0,0 +1,73 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { + PluginInitializerContext, + CoreSetup, + CoreStart, + Plugin, + Logger, +} from '../../../src/core/server'; + +import { + SearchExamplesPluginSetup, + SearchExamplesPluginStart, + SearchExamplesPluginSetupDeps, + SearchExamplesPluginStartDeps, +} from './types'; +import { mySearchStrategyProvider } from './my_strategy'; +import { registerRoutes } from './routes'; + +export class SearchExamplesPlugin + implements + Plugin< + SearchExamplesPluginSetup, + SearchExamplesPluginStart, + SearchExamplesPluginSetupDeps, + SearchExamplesPluginStartDeps + > { + private readonly logger: Logger; + + constructor(initializerContext: PluginInitializerContext) { + this.logger = initializerContext.logger.get(); + } + + public setup( + core: CoreSetup, + deps: SearchExamplesPluginSetupDeps + ) { + this.logger.debug('search_examples: Setup'); + const router = core.http.createRouter(); + + core.getStartServices().then(([_, depsStart]) => { + const myStrategy = mySearchStrategyProvider(depsStart.data); + deps.data.search.registerSearchStrategy('myStrategy', myStrategy); + registerRoutes(router, depsStart.data); + }); + + return {}; + } + + public start(core: CoreStart) { + this.logger.debug('search_examples: Started'); + return {}; + } + + public stop() {} +} diff --git a/src/plugins/kibana_utils/public/field_wildcard/index.ts b/examples/search_examples/server/routes/index.ts similarity index 93% rename from src/plugins/kibana_utils/public/field_wildcard/index.ts rename to examples/search_examples/server/routes/index.ts index db9f830e450b83..ea575cf371bb7d 100644 --- a/src/plugins/kibana_utils/public/field_wildcard/index.ts +++ b/examples/search_examples/server/routes/index.ts @@ -16,5 +16,4 @@ * specific language governing permissions and limitations * under the License. */ - -export * from './field_wildcard'; +export { registerRoutes } from './register_routes'; diff --git a/examples/search_examples/server/routes/register_routes.ts b/examples/search_examples/server/routes/register_routes.ts new file mode 100644 index 00000000000000..ac3ea28d89d26e --- /dev/null +++ b/examples/search_examples/server/routes/register_routes.ts @@ -0,0 +1,26 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { IRouter } from 'kibana/server'; +import { PluginStart as DataPluginStart } from 'src/plugins/data/server'; +import { registerServerSearchRoute } from './server_search_route'; + +export function registerRoutes(router: IRouter, data: DataPluginStart) { + registerServerSearchRoute(router, data); +} diff --git a/examples/search_examples/server/routes/server_search_route.ts b/examples/search_examples/server/routes/server_search_route.ts new file mode 100644 index 00000000000000..6eb21cf34b4a31 --- /dev/null +++ b/examples/search_examples/server/routes/server_search_route.ts @@ -0,0 +1,70 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { PluginStart as DataPluginStart, IEsSearchRequest } from 'src/plugins/data/server'; +import { schema } from '@kbn/config-schema'; +import { IEsSearchResponse } from 'src/plugins/data/common'; +import { IRouter } from '../../../../src/core/server'; +import { SERVER_SEARCH_ROUTE_PATH } from '../../common'; + +export function registerServerSearchRoute(router: IRouter, data: DataPluginStart) { + router.get( + { + path: SERVER_SEARCH_ROUTE_PATH, + validate: { + query: schema.object({ + index: schema.maybe(schema.string()), + field: schema.maybe(schema.string()), + }), + }, + }, + async (context, request, response) => { + const { index, field } = request.query; + // Run a synchronous search server side, by enforcing a high keepalive and waiting for completion. + // If you wish to run the search with polling (in basic+), you'd have to poll on the search API. + // Please reach out to the @app-arch-team if you need this to be implemented. + const res = await data.search.search( + context, + { + params: { + index, + body: { + aggs: { + '1': { + avg: { + field, + }, + }, + }, + }, + waitForCompletionTimeout: '5m', + keepAlive: '5m', + }, + } as IEsSearchRequest, + {} + ); + + return response.ok({ + body: { + aggs: (res as IEsSearchResponse).rawResponse.aggregations, + }, + }); + } + ); +} diff --git a/examples/search_examples/server/types.ts b/examples/search_examples/server/types.ts new file mode 100644 index 00000000000000..da0f24a3012bb3 --- /dev/null +++ b/examples/search_examples/server/types.ts @@ -0,0 +1,34 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Rename PluginStart to something better +import { PluginSetup, PluginStart } from '../../../src/plugins/data/server'; + +export interface SearchExamplesPluginSetupDeps { + data: PluginSetup; +} + +export interface SearchExamplesPluginStartDeps { + data: PluginStart; +} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface SearchExamplesPluginSetup {} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface SearchExamplesPluginStart {} diff --git a/examples/search_examples/tsconfig.json b/examples/search_examples/tsconfig.json new file mode 100644 index 00000000000000..8a3ced743d0fa3 --- /dev/null +++ b/examples/search_examples/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "./target", + "skipLibCheck": true + }, + "include": [ + "index.ts", + "common/**/*.ts", + "public/**/*.ts", + "public/**/*.tsx", + "server/**/*.ts", + "../../typings/**/*", + ], + "exclude": [] +} diff --git a/packages/kbn-dev-utils/package.json b/packages/kbn-dev-utils/package.json index 83a7a7607816c8..7ce433f80bed08 100644 --- a/packages/kbn-dev-utils/package.json +++ b/packages/kbn-dev-utils/package.json @@ -11,7 +11,7 @@ }, "dependencies": { "axios": "^0.19.0", - "chalk": "^2.4.2", + "chalk": "^4.1.0", "dedent": "^0.7.0", "execa": "^4.0.2", "exit-hook": "^2.2.0", diff --git a/packages/kbn-es/package.json b/packages/kbn-es/package.json index f53eb694ec7123..c3670f648d3093 100644 --- a/packages/kbn-es/package.json +++ b/packages/kbn-es/package.json @@ -8,7 +8,7 @@ "@elastic/elasticsearch": "7.9.0-rc.1", "@kbn/dev-utils": "1.0.0", "abort-controller": "^2.0.3", - "chalk": "^2.4.2", + "chalk": "^4.1.0", "dedent": "^0.7.0", "del": "^5.1.0", "execa": "^4.0.2", diff --git a/packages/kbn-plugin-generator/package.json b/packages/kbn-plugin-generator/package.json index 5c1e98cd869de0..0803e498279f3f 100644 --- a/packages/kbn-plugin-generator/package.json +++ b/packages/kbn-plugin-generator/package.json @@ -4,7 +4,7 @@ "private": true, "version": "1.0.0", "dependencies": { - "chalk": "^2.4.2", + "chalk": "^4.1.0", "dedent": "^0.7.0", "execa": "^4.0.2", "getopts": "^2.2.4", diff --git a/packages/kbn-pm/dist/index.js b/packages/kbn-pm/dist/index.js index b8794124ad197d..ee141e1d8ab7a4 100644 --- a/packages/kbn-pm/dist/index.js +++ b/packages/kbn-pm/dist/index.js @@ -94,21 +94,21 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _cli__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "run", function() { return _cli__WEBPACK_IMPORTED_MODULE_0__["run"]; }); -/* harmony import */ var _production__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(498); +/* harmony import */ var _production__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(511); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buildProductionProjects", function() { return _production__WEBPACK_IMPORTED_MODULE_1__["buildProductionProjects"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "prepareExternalProjectDependencies", function() { return _production__WEBPACK_IMPORTED_MODULE_1__["prepareExternalProjectDependencies"]; }); -/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(144); +/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(145); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getProjects", function() { return _utils_projects__WEBPACK_IMPORTED_MODULE_2__["getProjects"]; }); -/* harmony import */ var _utils_project__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(162); +/* harmony import */ var _utils_project__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(163); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Project", function() { return _utils_project__WEBPACK_IMPORTED_MODULE_3__["Project"]; }); -/* harmony import */ var _utils_workspaces__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(271); +/* harmony import */ var _utils_workspaces__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(287); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "copyWorkspacePackages", function() { return _utils_workspaces__WEBPACK_IMPORTED_MODULE_4__["copyWorkspacePackages"]; }); -/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(272); +/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(288); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getProjectPaths", function() { return _config__WEBPACK_IMPORTED_MODULE_5__["getProjectPaths"]; }); /* @@ -151,9 +151,9 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _kbn_dev_utils_tooling_log__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5); /* harmony import */ var _kbn_dev_utils_tooling_log__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_kbn_dev_utils_tooling_log__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(126); -/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(490); -/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(142); +/* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(127); +/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(503); +/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(143); /* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with @@ -568,10 +568,10 @@ var tooling_log_1 = __webpack_require__(6); Object.defineProperty(exports, "ToolingLog", { enumerable: true, get: function () { return tooling_log_1.ToolingLog; } }); var tooling_log_text_writer_1 = __webpack_require__(110); Object.defineProperty(exports, "ToolingLogTextWriter", { enumerable: true, get: function () { return tooling_log_text_writer_1.ToolingLogTextWriter; } }); -var log_levels_1 = __webpack_require__(124); +var log_levels_1 = __webpack_require__(125); Object.defineProperty(exports, "pickLevelFromFlags", { enumerable: true, get: function () { return log_levels_1.pickLevelFromFlags; } }); Object.defineProperty(exports, "parseLogLevel", { enumerable: true, get: function () { return log_levels_1.parseLogLevel; } }); -var tooling_log_collecting_writer_1 = __webpack_require__(125); +var tooling_log_collecting_writer_1 = __webpack_require__(126); Object.defineProperty(exports, "ToolingLogCollectingWriter", { enumerable: true, get: function () { return tooling_log_collecting_writer_1.ToolingLogCollectingWriter; } }); @@ -6594,7 +6594,7 @@ exports.ToolingLogTextWriter = void 0; const tslib_1 = __webpack_require__(7); const util_1 = __webpack_require__(111); const chalk_1 = tslib_1.__importDefault(__webpack_require__(112)); -const log_levels_1 = __webpack_require__(124); +const log_levels_1 = __webpack_require__(125); const { magentaBright, yellow, red, blue, green, dim } = chalk_1.default; const PREFIX_INDENT = ' '.repeat(6); const MSG_PREFIXES = { @@ -6672,233 +6672,234 @@ module.exports = require("util"); "use strict"; -const escapeStringRegexp = __webpack_require__(113); -const ansiStyles = __webpack_require__(114); -const stdoutColor = __webpack_require__(120).stdout; - -const template = __webpack_require__(123); +const ansiStyles = __webpack_require__(113); +const {stdout: stdoutColor, stderr: stderrColor} = __webpack_require__(119); +const { + stringReplaceAll, + stringEncaseCRLFWithFirstIndex +} = __webpack_require__(123); -const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); +const {isArray} = Array; // `supportsColor.level` → `ansiStyles.color[name]` mapping -const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; - -// `color-convert` models to exclude from the Chalk API due to conflicts and such -const skipModels = new Set(['gray']); +const levelMapping = [ + 'ansi', + 'ansi', + 'ansi256', + 'ansi16m' +]; const styles = Object.create(null); -function applyOptions(obj, options) { - options = options || {}; +const applyOptions = (object, options = {}) => { + if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) { + throw new Error('The `level` option should be an integer from 0 to 3'); + } // Detect level if not set manually - const scLevel = stdoutColor ? stdoutColor.level : 0; - obj.level = options.level === undefined ? scLevel : options.level; - obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0; + const colorLevel = stdoutColor ? stdoutColor.level : 0; + object.level = options.level === undefined ? colorLevel : options.level; +}; + +class ChalkClass { + constructor(options) { + // eslint-disable-next-line no-constructor-return + return chalkFactory(options); + } } -function Chalk(options) { - // We check for this.template here since calling `chalk.constructor()` - // by itself will have a `this` of a previously constructed chalk object - if (!this || !(this instanceof Chalk) || this.template) { - const chalk = {}; - applyOptions(chalk, options); +const chalkFactory = options => { + const chalk = {}; + applyOptions(chalk, options); - chalk.template = function () { - const args = [].slice.call(arguments); - return chalkTag.apply(null, [chalk.template].concat(args)); - }; + chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_); - Object.setPrototypeOf(chalk, Chalk.prototype); - Object.setPrototypeOf(chalk.template, chalk); + Object.setPrototypeOf(chalk, Chalk.prototype); + Object.setPrototypeOf(chalk.template, chalk); - chalk.template.constructor = Chalk; + chalk.template.constructor = () => { + throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.'); + }; - return chalk.template; - } + chalk.template.Instance = ChalkClass; - applyOptions(this, options); -} + return chalk.template; +}; -// Use bright blue on Windows as the normal blue color is illegible -if (isSimpleWindowsTerm) { - ansiStyles.blue.open = '\u001B[94m'; +function Chalk(options) { + return chalkFactory(options); } -for (const key of Object.keys(ansiStyles)) { - ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); - - styles[key] = { +for (const [styleName, style] of Object.entries(ansiStyles)) { + styles[styleName] = { get() { - const codes = ansiStyles[key]; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key); + const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty); + Object.defineProperty(this, styleName, {value: builder}); + return builder; } }; } styles.visible = { get() { - return build.call(this, this._styles || [], true, 'visible'); + const builder = createBuilder(this, this._styler, true); + Object.defineProperty(this, 'visible', {value: builder}); + return builder; } }; -ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g'); -for (const model of Object.keys(ansiStyles.color.ansi)) { - if (skipModels.has(model)) { - continue; - } +const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256']; +for (const model of usedModels) { styles[model] = { get() { - const level = this.level; - return function () { - const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments); - const codes = { - open, - close: ansiStyles.color.close, - closeRe: ansiStyles.color.closeRe - }; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); + const {level} = this; + return function (...arguments_) { + const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler); + return createBuilder(this, styler, this._isEmpty); }; } }; } -ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g'); -for (const model of Object.keys(ansiStyles.bgColor.ansi)) { - if (skipModels.has(model)) { - continue; - } - +for (const model of usedModels) { const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); styles[bgModel] = { get() { - const level = this.level; - return function () { - const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments); - const codes = { - open, - close: ansiStyles.bgColor.close, - closeRe: ansiStyles.bgColor.closeRe - }; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); + const {level} = this; + return function (...arguments_) { + const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler); + return createBuilder(this, styler, this._isEmpty); }; } }; } -const proto = Object.defineProperties(() => {}, styles); - -function build(_styles, _empty, key) { - const builder = function () { - return applyStyle.apply(builder, arguments); - }; - - builder._styles = _styles; - builder._empty = _empty; - - const self = this; - - Object.defineProperty(builder, 'level', { +const proto = Object.defineProperties(() => {}, { + ...styles, + level: { enumerable: true, get() { - return self.level; + return this._generator.level; }, set(level) { - self.level = level; + this._generator.level = level; } - }); + } +}); - Object.defineProperty(builder, 'enabled', { - enumerable: true, - get() { - return self.enabled; - }, - set(enabled) { - self.enabled = enabled; +const createStyler = (open, close, parent) => { + let openAll; + let closeAll; + if (parent === undefined) { + openAll = open; + closeAll = close; + } else { + openAll = parent.openAll + open; + closeAll = close + parent.closeAll; + } + + return { + open, + close, + openAll, + closeAll, + parent + }; +}; + +const createBuilder = (self, _styler, _isEmpty) => { + const builder = (...arguments_) => { + if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) { + // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}` + return applyStyle(builder, chalkTag(builder, ...arguments_)); } - }); - // See below for fix regarding invisible grey/dim combination on Windows - builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; + // Single argument is hot path, implicit coercion is faster than anything + // eslint-disable-next-line no-implicit-coercion + return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' ')); + }; - // `__proto__` is used because we must return a function, but there is + // We alter the prototype because we must return a function, but there is // no way to create a function with a different prototype - builder.__proto__ = proto; // eslint-disable-line no-proto + Object.setPrototypeOf(builder, proto); - return builder; -} + builder._generator = self; + builder._styler = _styler; + builder._isEmpty = _isEmpty; -function applyStyle() { - // Support varags, but simply cast to string in case there's only one arg - const args = arguments; - const argsLen = args.length; - let str = String(arguments[0]); + return builder; +}; - if (argsLen === 0) { - return ''; +const applyStyle = (self, string) => { + if (self.level <= 0 || !string) { + return self._isEmpty ? '' : string; } - if (argsLen > 1) { - // Don't slice `arguments`, it prevents V8 optimizations - for (let a = 1; a < argsLen; a++) { - str += ' ' + args[a]; - } - } + let styler = self._styler; - if (!this.enabled || this.level <= 0 || !str) { - return this._empty ? '' : str; + if (styler === undefined) { + return string; } - // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, - // see https://github.com/chalk/chalk/issues/58 - // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. - const originalDim = ansiStyles.dim.open; - if (isSimpleWindowsTerm && this.hasGrey) { - ansiStyles.dim.open = ''; - } + const {openAll, closeAll} = styler; + if (string.indexOf('\u001B') !== -1) { + while (styler !== undefined) { + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + string = stringReplaceAll(string, styler.close, styler.open); - for (const code of this._styles.slice().reverse()) { - // Replace any instances already present with a re-opening code - // otherwise only the part of the string until said closing code - // will be colored, and the rest will simply be 'plain'. - str = code.open + str.replace(code.closeRe, code.open) + code.close; + styler = styler.parent; + } + } - // Close the styling before a linebreak and reopen - // after next line to fix a bleed issue on macOS - // https://github.com/chalk/chalk/pull/92 - str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`); + // We can move both next actions out of loop, because remaining actions in loop won't have + // any/visible effect on parts we add here. Close the styling before a linebreak and reopen + // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92 + const lfIndex = string.indexOf('\n'); + if (lfIndex !== -1) { + string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex); } - // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue - ansiStyles.dim.open = originalDim; + return openAll + string + closeAll; +}; - return str; -} +let template; +const chalkTag = (chalk, ...strings) => { + const [firstString] = strings; -function chalkTag(chalk, strings) { - if (!Array.isArray(strings)) { + if (!isArray(firstString) || !isArray(firstString.raw)) { // If chalk() was called by itself or with a string, // return the string itself as a string. - return [].slice.call(arguments, 1).join(' '); + return strings.join(' '); } - const args = [].slice.call(arguments, 2); - const parts = [strings.raw[0]]; + const arguments_ = strings.slice(1); + const parts = [firstString.raw[0]]; - for (let i = 1; i < strings.length; i++) { - parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&')); - parts.push(String(strings.raw[i])); + for (let i = 1; i < firstString.length; i++) { + parts.push( + String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), + String(firstString.raw[i]) + ); + } + + if (template === undefined) { + template = __webpack_require__(124); } return template(chalk, parts.join('')); -} +}; Object.defineProperties(Chalk.prototype, styles); -module.exports = Chalk(); // eslint-disable-line new-cap -module.exports.supportsColor = stdoutColor; -module.exports.default = module.exports; // For TypeScript +const chalk = Chalk(); // eslint-disable-line new-cap +chalk.supportsColor = stdoutColor; +chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap +chalk.stderr.supportsColor = stderrColor; + +module.exports = chalk; /***/ }), @@ -6906,40 +6907,64 @@ module.exports.default = module.exports; // For TypeScript /***/ (function(module, exports, __webpack_require__) { "use strict"; +/* WEBPACK VAR INJECTION */(function(module) { +const wrapAnsi16 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${code + offset}m`; +}; -var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; - -module.exports = function (str) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); - } +const wrapAnsi256 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${38 + offset};5;${code}m`; +}; - return str.replace(matchOperatorsRe, '\\$&'); +const wrapAnsi16m = (fn, offset) => (...args) => { + const rgb = fn(...args); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; }; +const ansi2ansi = n => n; +const rgb2rgb = (r, g, b) => [r, g, b]; -/***/ }), -/* 114 */ -/***/ (function(module, exports, __webpack_require__) { +const setLazyProperty = (object, property, get) => { + Object.defineProperty(object, property, { + get: () => { + const value = get(); -"use strict"; -/* WEBPACK VAR INJECTION */(function(module) { -const colorConvert = __webpack_require__(116); + Object.defineProperty(object, property, { + value, + enumerable: true, + configurable: true + }); -const wrapAnsi16 = (fn, offset) => function () { - const code = fn.apply(colorConvert, arguments); - return `\u001B[${code + offset}m`; + return value; + }, + enumerable: true, + configurable: true + }); }; -const wrapAnsi256 = (fn, offset) => function () { - const code = fn.apply(colorConvert, arguments); - return `\u001B[${38 + offset};5;${code}m`; -}; +/** @type {typeof import('color-convert')} */ +let colorConvert; +const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { + if (colorConvert === undefined) { + colorConvert = __webpack_require__(115); + } -const wrapAnsi16m = (fn, offset) => function () { - const rgb = fn.apply(colorConvert, arguments); - return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; + const offset = isBackground ? 10 : 0; + const styles = {}; + + for (const [sourceSpace, suite] of Object.entries(colorConvert)) { + const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; + if (sourceSpace === targetSpace) { + styles[name] = wrap(identity, offset); + } else if (typeof suite === 'object') { + styles[name] = wrap(suite[targetSpace], offset); + } + } + + return styles; }; function assembleStyles() { @@ -6965,9 +6990,9 @@ function assembleStyles() { magenta: [35, 39], cyan: [36, 39], white: [37, 39], - gray: [90, 39], // Bright color + blackBright: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], @@ -6998,15 +7023,14 @@ function assembleStyles() { } }; - // Fix humans - styles.color.grey = styles.color.gray; - - for (const groupName of Object.keys(styles)) { - const group = styles[groupName]; - - for (const styleName of Object.keys(group)) { - const style = group[styleName]; + // Alias bright black as gray (and grey) + styles.color.gray = styles.color.blackBright; + styles.bgColor.bgGray = styles.bgColor.bgBlackBright; + styles.color.grey = styles.color.blackBright; + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { styles[styleName] = { open: `\u001B[${style[0]}m`, close: `\u001B[${style[1]}m` @@ -7021,65 +7045,22 @@ function assembleStyles() { value: group, enumerable: false }); - - Object.defineProperty(styles, 'codes', { - value: codes, - enumerable: false - }); } - const ansi2ansi = n => n; - const rgb2rgb = (r, g, b) => [r, g, b]; + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); styles.color.close = '\u001B[39m'; styles.bgColor.close = '\u001B[49m'; - styles.color.ansi = { - ansi: wrapAnsi16(ansi2ansi, 0) - }; - styles.color.ansi256 = { - ansi256: wrapAnsi256(ansi2ansi, 0) - }; - styles.color.ansi16m = { - rgb: wrapAnsi16m(rgb2rgb, 0) - }; - - styles.bgColor.ansi = { - ansi: wrapAnsi16(ansi2ansi, 10) - }; - styles.bgColor.ansi256 = { - ansi256: wrapAnsi256(ansi2ansi, 10) - }; - styles.bgColor.ansi16m = { - rgb: wrapAnsi16m(rgb2rgb, 10) - }; - - for (let key of Object.keys(colorConvert)) { - if (typeof colorConvert[key] !== 'object') { - continue; - } - - const suite = colorConvert[key]; - - if (key === 'ansi16') { - key = 'ansi'; - } - - if ('ansi16' in suite) { - styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0); - styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10); - } - - if ('ansi256' in suite) { - styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0); - styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10); - } - - if ('rgb' in suite) { - styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0); - styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10); - } - } + setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); + setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); return styles; } @@ -7090,10 +7071,10 @@ Object.defineProperty(module, 'exports', { get: assembleStyles }); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(115)(module))) +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(114)(module))) /***/ }), -/* 115 */ +/* 114 */ /***/ (function(module, exports) { module.exports = function(module) { @@ -7121,30 +7102,31 @@ module.exports = function(module) { /***/ }), -/* 116 */ +/* 115 */ /***/ (function(module, exports, __webpack_require__) { -var conversions = __webpack_require__(117); -var route = __webpack_require__(119); +const conversions = __webpack_require__(116); +const route = __webpack_require__(118); -var convert = {}; +const convert = {}; -var models = Object.keys(conversions); +const models = Object.keys(conversions); function wrapRaw(fn) { - var wrappedFn = function (args) { - if (args === undefined || args === null) { - return args; + const wrappedFn = function (...args) { + const arg0 = args[0]; + if (arg0 === undefined || arg0 === null) { + return arg0; } - if (arguments.length > 1) { - args = Array.prototype.slice.call(arguments); + if (arg0.length > 1) { + args = arg0; } return fn(args); }; - // preserve .conversion property if there is one + // Preserve .conversion property if there is one if ('conversion' in fn) { wrappedFn.conversion = fn.conversion; } @@ -7153,22 +7135,24 @@ function wrapRaw(fn) { } function wrapRounded(fn) { - var wrappedFn = function (args) { - if (args === undefined || args === null) { - return args; + const wrappedFn = function (...args) { + const arg0 = args[0]; + + if (arg0 === undefined || arg0 === null) { + return arg0; } - if (arguments.length > 1) { - args = Array.prototype.slice.call(arguments); + if (arg0.length > 1) { + args = arg0; } - var result = fn(args); + const result = fn(args); - // we're assuming the result is an array here. + // We're assuming the result is an array here. // see notice in conversions.js; don't use box types // in conversion functions. if (typeof result === 'object') { - for (var len = result.length, i = 0; i < len; i++) { + for (let len = result.length, i = 0; i < len; i++) { result[i] = Math.round(result[i]); } } @@ -7176,7 +7160,7 @@ function wrapRounded(fn) { return result; }; - // preserve .conversion property if there is one + // Preserve .conversion property if there is one if ('conversion' in fn) { wrappedFn.conversion = fn.conversion; } @@ -7184,17 +7168,17 @@ function wrapRounded(fn) { return wrappedFn; } -models.forEach(function (fromModel) { +models.forEach(fromModel => { convert[fromModel] = {}; Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); - var routes = route(fromModel); - var routeModels = Object.keys(routes); + const routes = route(fromModel); + const routeModels = Object.keys(routes); - routeModels.forEach(function (toModel) { - var fn = routes[toModel]; + routeModels.forEach(toModel => { + const fn = routes[toModel]; convert[fromModel][toModel] = wrapRounded(fn); convert[fromModel][toModel].raw = wrapRaw(fn); @@ -7205,24 +7189,23 @@ module.exports = convert; /***/ }), -/* 117 */ +/* 116 */ /***/ (function(module, exports, __webpack_require__) { /* MIT license */ -var cssKeywords = __webpack_require__(118); +/* eslint-disable no-mixed-operators */ +const cssKeywords = __webpack_require__(117); // NOTE: conversions should only return primitive values (i.e. arrays, or // values that give correct `typeof` results). // do not use box values types (i.e. Number(), String(), etc.) -var reverseKeywords = {}; -for (var key in cssKeywords) { - if (cssKeywords.hasOwnProperty(key)) { - reverseKeywords[cssKeywords[key]] = key; - } +const reverseKeywords = {}; +for (const key of Object.keys(cssKeywords)) { + reverseKeywords[cssKeywords[key]] = key; } -var convert = module.exports = { +const convert = { rgb: {channels: 3, labels: 'rgb'}, hsl: {channels: 3, labels: 'hsl'}, hsv: {channels: 3, labels: 'hsv'}, @@ -7240,40 +7223,38 @@ var convert = module.exports = { gray: {channels: 1, labels: ['gray']} }; -// hide .channels and .labels properties -for (var model in convert) { - if (convert.hasOwnProperty(model)) { - if (!('channels' in convert[model])) { - throw new Error('missing channels property: ' + model); - } +module.exports = convert; - if (!('labels' in convert[model])) { - throw new Error('missing channel labels property: ' + model); - } +// Hide .channels and .labels properties +for (const model of Object.keys(convert)) { + if (!('channels' in convert[model])) { + throw new Error('missing channels property: ' + model); + } - if (convert[model].labels.length !== convert[model].channels) { - throw new Error('channel and label counts mismatch: ' + model); - } + if (!('labels' in convert[model])) { + throw new Error('missing channel labels property: ' + model); + } - var channels = convert[model].channels; - var labels = convert[model].labels; - delete convert[model].channels; - delete convert[model].labels; - Object.defineProperty(convert[model], 'channels', {value: channels}); - Object.defineProperty(convert[model], 'labels', {value: labels}); + if (convert[model].labels.length !== convert[model].channels) { + throw new Error('channel and label counts mismatch: ' + model); } + + const {channels, labels} = convert[model]; + delete convert[model].channels; + delete convert[model].labels; + Object.defineProperty(convert[model], 'channels', {value: channels}); + Object.defineProperty(convert[model], 'labels', {value: labels}); } convert.rgb.hsl = function (rgb) { - var r = rgb[0] / 255; - var g = rgb[1] / 255; - var b = rgb[2] / 255; - var min = Math.min(r, g, b); - var max = Math.max(r, g, b); - var delta = max - min; - var h; - var s; - var l; + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const min = Math.min(r, g, b); + const max = Math.max(r, g, b); + const delta = max - min; + let h; + let s; if (max === min) { h = 0; @@ -7291,7 +7272,7 @@ convert.rgb.hsl = function (rgb) { h += 360; } - l = (min + max) / 2; + const l = (min + max) / 2; if (max === min) { s = 0; @@ -7305,49 +7286,58 @@ convert.rgb.hsl = function (rgb) { }; convert.rgb.hsv = function (rgb) { - var r = rgb[0]; - var g = rgb[1]; - var b = rgb[2]; - var min = Math.min(r, g, b); - var max = Math.max(r, g, b); - var delta = max - min; - var h; - var s; - var v; + let rdif; + let gdif; + let bdif; + let h; + let s; + + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const v = Math.max(r, g, b); + const diff = v - Math.min(r, g, b); + const diffc = function (c) { + return (v - c) / 6 / diff + 1 / 2; + }; - if (max === 0) { + if (diff === 0) { + h = 0; s = 0; } else { - s = (delta / max * 1000) / 10; - } - - if (max === min) { - h = 0; - } else if (r === max) { - h = (g - b) / delta; - } else if (g === max) { - h = 2 + (b - r) / delta; - } else if (b === max) { - h = 4 + (r - g) / delta; - } - - h = Math.min(h * 60, 360); + s = diff / v; + rdif = diffc(r); + gdif = diffc(g); + bdif = diffc(b); + + if (r === v) { + h = bdif - gdif; + } else if (g === v) { + h = (1 / 3) + rdif - bdif; + } else if (b === v) { + h = (2 / 3) + gdif - rdif; + } - if (h < 0) { - h += 360; + if (h < 0) { + h += 1; + } else if (h > 1) { + h -= 1; + } } - v = ((max / 255) * 1000) / 10; - - return [h, s, v]; + return [ + h * 360, + s * 100, + v * 100 + ]; }; convert.rgb.hwb = function (rgb) { - var r = rgb[0]; - var g = rgb[1]; - var b = rgb[2]; - var h = convert.rgb.hsl(rgb)[0]; - var w = 1 / 255 * Math.min(r, Math.min(g, b)); + const r = rgb[0]; + const g = rgb[1]; + let b = rgb[2]; + const h = convert.rgb.hsl(rgb)[0]; + const w = 1 / 255 * Math.min(r, Math.min(g, b)); b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); @@ -7355,54 +7345,48 @@ convert.rgb.hwb = function (rgb) { }; convert.rgb.cmyk = function (rgb) { - var r = rgb[0] / 255; - var g = rgb[1] / 255; - var b = rgb[2] / 255; - var c; - var m; - var y; - var k; + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; - k = Math.min(1 - r, 1 - g, 1 - b); - c = (1 - r - k) / (1 - k) || 0; - m = (1 - g - k) / (1 - k) || 0; - y = (1 - b - k) / (1 - k) || 0; + const k = Math.min(1 - r, 1 - g, 1 - b); + const c = (1 - r - k) / (1 - k) || 0; + const m = (1 - g - k) / (1 - k) || 0; + const y = (1 - b - k) / (1 - k) || 0; return [c * 100, m * 100, y * 100, k * 100]; }; -/** - * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance - * */ function comparativeDistance(x, y) { + /* + See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance + */ return ( - Math.pow(x[0] - y[0], 2) + - Math.pow(x[1] - y[1], 2) + - Math.pow(x[2] - y[2], 2) + ((x[0] - y[0]) ** 2) + + ((x[1] - y[1]) ** 2) + + ((x[2] - y[2]) ** 2) ); } convert.rgb.keyword = function (rgb) { - var reversed = reverseKeywords[rgb]; + const reversed = reverseKeywords[rgb]; if (reversed) { return reversed; } - var currentClosestDistance = Infinity; - var currentClosestKeyword; + let currentClosestDistance = Infinity; + let currentClosestKeyword; - for (var keyword in cssKeywords) { - if (cssKeywords.hasOwnProperty(keyword)) { - var value = cssKeywords[keyword]; + for (const keyword of Object.keys(cssKeywords)) { + const value = cssKeywords[keyword]; - // Compute comparative distance - var distance = comparativeDistance(rgb, value); + // Compute comparative distance + const distance = comparativeDistance(rgb, value); - // Check if its less, if so set as closest - if (distance < currentClosestDistance) { - currentClosestDistance = distance; - currentClosestKeyword = keyword; - } + // Check if its less, if so set as closest + if (distance < currentClosestDistance) { + currentClosestDistance = distance; + currentClosestKeyword = keyword; } } @@ -7414,55 +7398,50 @@ convert.keyword.rgb = function (keyword) { }; convert.rgb.xyz = function (rgb) { - var r = rgb[0] / 255; - var g = rgb[1] / 255; - var b = rgb[2] / 255; + let r = rgb[0] / 255; + let g = rgb[1] / 255; + let b = rgb[2] / 255; - // assume sRGB - r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92); - g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92); - b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92); + // Assume sRGB + r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92); + g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92); + b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92); - var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); - var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); - var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); + const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); + const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); + const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); return [x * 100, y * 100, z * 100]; }; convert.rgb.lab = function (rgb) { - var xyz = convert.rgb.xyz(rgb); - var x = xyz[0]; - var y = xyz[1]; - var z = xyz[2]; - var l; - var a; - var b; + const xyz = convert.rgb.xyz(rgb); + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; x /= 95.047; y /= 100; z /= 108.883; - x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116); + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); - l = (116 * y) - 16; - a = 500 * (x - y); - b = 200 * (y - z); + const l = (116 * y) - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); return [l, a, b]; }; convert.hsl.rgb = function (hsl) { - var h = hsl[0] / 360; - var s = hsl[1] / 100; - var l = hsl[2] / 100; - var t1; - var t2; - var t3; - var rgb; - var val; + const h = hsl[0] / 360; + const s = hsl[1] / 100; + const l = hsl[2] / 100; + let t2; + let t3; + let val; if (s === 0) { val = l * 255; @@ -7475,14 +7454,15 @@ convert.hsl.rgb = function (hsl) { t2 = l + s - l * s; } - t1 = 2 * l - t2; + const t1 = 2 * l - t2; - rgb = [0, 0, 0]; - for (var i = 0; i < 3; i++) { + const rgb = [0, 0, 0]; + for (let i = 0; i < 3; i++) { t3 = h + 1 / 3 * -(i - 1); if (t3 < 0) { t3++; } + if (t3 > 1) { t3--; } @@ -7504,33 +7484,31 @@ convert.hsl.rgb = function (hsl) { }; convert.hsl.hsv = function (hsl) { - var h = hsl[0]; - var s = hsl[1] / 100; - var l = hsl[2] / 100; - var smin = s; - var lmin = Math.max(l, 0.01); - var sv; - var v; + const h = hsl[0]; + let s = hsl[1] / 100; + let l = hsl[2] / 100; + let smin = s; + const lmin = Math.max(l, 0.01); l *= 2; s *= (l <= 1) ? l : 2 - l; smin *= lmin <= 1 ? lmin : 2 - lmin; - v = (l + s) / 2; - sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); + const v = (l + s) / 2; + const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); return [h, sv * 100, v * 100]; }; convert.hsv.rgb = function (hsv) { - var h = hsv[0] / 60; - var s = hsv[1] / 100; - var v = hsv[2] / 100; - var hi = Math.floor(h) % 6; - - var f = h - Math.floor(h); - var p = 255 * v * (1 - s); - var q = 255 * v * (1 - (s * f)); - var t = 255 * v * (1 - (s * (1 - f))); + const h = hsv[0] / 60; + const s = hsv[1] / 100; + let v = hsv[2] / 100; + const hi = Math.floor(h) % 6; + + const f = h - Math.floor(h); + const p = 255 * v * (1 - s); + const q = 255 * v * (1 - (s * f)); + const t = 255 * v * (1 - (s * (1 - f))); v *= 255; switch (hi) { @@ -7550,16 +7528,15 @@ convert.hsv.rgb = function (hsv) { }; convert.hsv.hsl = function (hsv) { - var h = hsv[0]; - var s = hsv[1] / 100; - var v = hsv[2] / 100; - var vmin = Math.max(v, 0.01); - var lmin; - var sl; - var l; + const h = hsv[0]; + const s = hsv[1] / 100; + const v = hsv[2] / 100; + const vmin = Math.max(v, 0.01); + let sl; + let l; l = (2 - s) * v; - lmin = (2 - s) * vmin; + const lmin = (2 - s) * vmin; sl = s * vmin; sl /= (lmin <= 1) ? lmin : 2 - lmin; sl = sl || 0; @@ -7570,87 +7547,83 @@ convert.hsv.hsl = function (hsv) { // http://dev.w3.org/csswg/css-color/#hwb-to-rgb convert.hwb.rgb = function (hwb) { - var h = hwb[0] / 360; - var wh = hwb[1] / 100; - var bl = hwb[2] / 100; - var ratio = wh + bl; - var i; - var v; - var f; - var n; + const h = hwb[0] / 360; + let wh = hwb[1] / 100; + let bl = hwb[2] / 100; + const ratio = wh + bl; + let f; - // wh + bl cant be > 1 + // Wh + bl cant be > 1 if (ratio > 1) { wh /= ratio; bl /= ratio; } - i = Math.floor(6 * h); - v = 1 - bl; + const i = Math.floor(6 * h); + const v = 1 - bl; f = 6 * h - i; if ((i & 0x01) !== 0) { f = 1 - f; } - n = wh + f * (v - wh); // linear interpolation + const n = wh + f * (v - wh); // Linear interpolation - var r; - var g; - var b; + let r; + let g; + let b; + /* eslint-disable max-statements-per-line,no-multi-spaces */ switch (i) { default: case 6: - case 0: r = v; g = n; b = wh; break; - case 1: r = n; g = v; b = wh; break; - case 2: r = wh; g = v; b = n; break; - case 3: r = wh; g = n; b = v; break; - case 4: r = n; g = wh; b = v; break; - case 5: r = v; g = wh; b = n; break; + case 0: r = v; g = n; b = wh; break; + case 1: r = n; g = v; b = wh; break; + case 2: r = wh; g = v; b = n; break; + case 3: r = wh; g = n; b = v; break; + case 4: r = n; g = wh; b = v; break; + case 5: r = v; g = wh; b = n; break; } + /* eslint-enable max-statements-per-line,no-multi-spaces */ return [r * 255, g * 255, b * 255]; }; convert.cmyk.rgb = function (cmyk) { - var c = cmyk[0] / 100; - var m = cmyk[1] / 100; - var y = cmyk[2] / 100; - var k = cmyk[3] / 100; - var r; - var g; - var b; + const c = cmyk[0] / 100; + const m = cmyk[1] / 100; + const y = cmyk[2] / 100; + const k = cmyk[3] / 100; - r = 1 - Math.min(1, c * (1 - k) + k); - g = 1 - Math.min(1, m * (1 - k) + k); - b = 1 - Math.min(1, y * (1 - k) + k); + const r = 1 - Math.min(1, c * (1 - k) + k); + const g = 1 - Math.min(1, m * (1 - k) + k); + const b = 1 - Math.min(1, y * (1 - k) + k); return [r * 255, g * 255, b * 255]; }; convert.xyz.rgb = function (xyz) { - var x = xyz[0] / 100; - var y = xyz[1] / 100; - var z = xyz[2] / 100; - var r; - var g; - var b; + const x = xyz[0] / 100; + const y = xyz[1] / 100; + const z = xyz[2] / 100; + let r; + let g; + let b; r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); - // assume sRGB + // Assume sRGB r = r > 0.0031308 - ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055) + ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055) : r * 12.92; g = g > 0.0031308 - ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055) + ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055) : g * 12.92; b = b > 0.0031308 - ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055) + ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055) : b * 12.92; r = Math.min(Math.max(0, r), 1); @@ -7661,43 +7634,40 @@ convert.xyz.rgb = function (xyz) { }; convert.xyz.lab = function (xyz) { - var x = xyz[0]; - var y = xyz[1]; - var z = xyz[2]; - var l; - var a; - var b; + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; x /= 95.047; y /= 100; z /= 108.883; - x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116); + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); - l = (116 * y) - 16; - a = 500 * (x - y); - b = 200 * (y - z); + const l = (116 * y) - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); return [l, a, b]; }; convert.lab.xyz = function (lab) { - var l = lab[0]; - var a = lab[1]; - var b = lab[2]; - var x; - var y; - var z; + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let x; + let y; + let z; y = (l + 16) / 116; x = a / 500 + y; z = y - b / 200; - var y2 = Math.pow(y, 3); - var x2 = Math.pow(x, 3); - var z2 = Math.pow(z, 3); + const y2 = y ** 3; + const x2 = x ** 3; + const z2 = z ** 3; y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; @@ -7710,45 +7680,38 @@ convert.lab.xyz = function (lab) { }; convert.lab.lch = function (lab) { - var l = lab[0]; - var a = lab[1]; - var b = lab[2]; - var hr; - var h; - var c; + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let h; - hr = Math.atan2(b, a); + const hr = Math.atan2(b, a); h = hr * 360 / 2 / Math.PI; if (h < 0) { h += 360; } - c = Math.sqrt(a * a + b * b); + const c = Math.sqrt(a * a + b * b); return [l, c, h]; }; convert.lch.lab = function (lch) { - var l = lch[0]; - var c = lch[1]; - var h = lch[2]; - var a; - var b; - var hr; + const l = lch[0]; + const c = lch[1]; + const h = lch[2]; - hr = h / 360 * 2 * Math.PI; - a = c * Math.cos(hr); - b = c * Math.sin(hr); + const hr = h / 360 * 2 * Math.PI; + const a = c * Math.cos(hr); + const b = c * Math.sin(hr); return [l, a, b]; }; -convert.rgb.ansi16 = function (args) { - var r = args[0]; - var g = args[1]; - var b = args[2]; - var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization +convert.rgb.ansi16 = function (args, saturation = null) { + const [r, g, b] = args; + let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization value = Math.round(value / 50); @@ -7756,7 +7719,7 @@ convert.rgb.ansi16 = function (args) { return 30; } - var ansi = 30 + let ansi = 30 + ((Math.round(b / 255) << 2) | (Math.round(g / 255) << 1) | Math.round(r / 255)); @@ -7769,17 +7732,17 @@ convert.rgb.ansi16 = function (args) { }; convert.hsv.ansi16 = function (args) { - // optimization here; we already know the value and don't need to get + // Optimization here; we already know the value and don't need to get // it converted for us. return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); }; convert.rgb.ansi256 = function (args) { - var r = args[0]; - var g = args[1]; - var b = args[2]; + const r = args[0]; + const g = args[1]; + const b = args[2]; - // we use the extended greyscale palette here, with the exception of + // We use the extended greyscale palette here, with the exception of // black and white. normal palette only has 4 greyscale shades. if (r === g && g === b) { if (r < 8) { @@ -7793,7 +7756,7 @@ convert.rgb.ansi256 = function (args) { return Math.round(((r - 8) / 247) * 24) + 232; } - var ansi = 16 + const ansi = 16 + (36 * Math.round(r / 255 * 5)) + (6 * Math.round(g / 255 * 5)) + Math.round(b / 255 * 5); @@ -7802,9 +7765,9 @@ convert.rgb.ansi256 = function (args) { }; convert.ansi16.rgb = function (args) { - var color = args % 10; + let color = args % 10; - // handle greyscale + // Handle greyscale if (color === 0 || color === 7) { if (args > 50) { color += 3.5; @@ -7815,71 +7778,71 @@ convert.ansi16.rgb = function (args) { return [color, color, color]; } - var mult = (~~(args > 50) + 1) * 0.5; - var r = ((color & 1) * mult) * 255; - var g = (((color >> 1) & 1) * mult) * 255; - var b = (((color >> 2) & 1) * mult) * 255; + const mult = (~~(args > 50) + 1) * 0.5; + const r = ((color & 1) * mult) * 255; + const g = (((color >> 1) & 1) * mult) * 255; + const b = (((color >> 2) & 1) * mult) * 255; return [r, g, b]; }; convert.ansi256.rgb = function (args) { - // handle greyscale + // Handle greyscale if (args >= 232) { - var c = (args - 232) * 10 + 8; + const c = (args - 232) * 10 + 8; return [c, c, c]; } args -= 16; - var rem; - var r = Math.floor(args / 36) / 5 * 255; - var g = Math.floor((rem = args % 36) / 6) / 5 * 255; - var b = (rem % 6) / 5 * 255; + let rem; + const r = Math.floor(args / 36) / 5 * 255; + const g = Math.floor((rem = args % 36) / 6) / 5 * 255; + const b = (rem % 6) / 5 * 255; return [r, g, b]; }; convert.rgb.hex = function (args) { - var integer = ((Math.round(args[0]) & 0xFF) << 16) + const integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF); - var string = integer.toString(16).toUpperCase(); + const string = integer.toString(16).toUpperCase(); return '000000'.substring(string.length) + string; }; convert.hex.rgb = function (args) { - var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); + const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); if (!match) { return [0, 0, 0]; } - var colorString = match[0]; + let colorString = match[0]; if (match[0].length === 3) { - colorString = colorString.split('').map(function (char) { + colorString = colorString.split('').map(char => { return char + char; }).join(''); } - var integer = parseInt(colorString, 16); - var r = (integer >> 16) & 0xFF; - var g = (integer >> 8) & 0xFF; - var b = integer & 0xFF; + const integer = parseInt(colorString, 16); + const r = (integer >> 16) & 0xFF; + const g = (integer >> 8) & 0xFF; + const b = integer & 0xFF; return [r, g, b]; }; convert.rgb.hcg = function (rgb) { - var r = rgb[0] / 255; - var g = rgb[1] / 255; - var b = rgb[2] / 255; - var max = Math.max(Math.max(r, g), b); - var min = Math.min(Math.min(r, g), b); - var chroma = (max - min); - var grayscale; - var hue; + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const max = Math.max(Math.max(r, g), b); + const min = Math.min(Math.min(r, g), b); + const chroma = (max - min); + let grayscale; + let hue; if (chroma < 1) { grayscale = min / (1 - chroma); @@ -7896,7 +7859,7 @@ convert.rgb.hcg = function (rgb) { if (max === g) { hue = 2 + (b - r) / chroma; } else { - hue = 4 + (r - g) / chroma + 4; + hue = 4 + (r - g) / chroma; } hue /= 6; @@ -7906,17 +7869,12 @@ convert.rgb.hcg = function (rgb) { }; convert.hsl.hcg = function (hsl) { - var s = hsl[1] / 100; - var l = hsl[2] / 100; - var c = 1; - var f = 0; + const s = hsl[1] / 100; + const l = hsl[2] / 100; - if (l < 0.5) { - c = 2.0 * s * l; - } else { - c = 2.0 * s * (1.0 - l); - } + const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l)); + let f = 0; if (c < 1.0) { f = (l - 0.5 * c) / (1.0 - c); } @@ -7925,11 +7883,11 @@ convert.hsl.hcg = function (hsl) { }; convert.hsv.hcg = function (hsv) { - var s = hsv[1] / 100; - var v = hsv[2] / 100; + const s = hsv[1] / 100; + const v = hsv[2] / 100; - var c = s * v; - var f = 0; + const c = s * v; + let f = 0; if (c < 1.0) { f = (v - c) / (1 - c); @@ -7939,20 +7897,21 @@ convert.hsv.hcg = function (hsv) { }; convert.hcg.rgb = function (hcg) { - var h = hcg[0] / 360; - var c = hcg[1] / 100; - var g = hcg[2] / 100; + const h = hcg[0] / 360; + const c = hcg[1] / 100; + const g = hcg[2] / 100; if (c === 0.0) { return [g * 255, g * 255, g * 255]; } - var pure = [0, 0, 0]; - var hi = (h % 1) * 6; - var v = hi % 1; - var w = 1 - v; - var mg = 0; + const pure = [0, 0, 0]; + const hi = (h % 1) * 6; + const v = hi % 1; + const w = 1 - v; + let mg = 0; + /* eslint-disable max-statements-per-line */ switch (Math.floor(hi)) { case 0: pure[0] = 1; pure[1] = v; pure[2] = 0; break; @@ -7967,6 +7926,7 @@ convert.hcg.rgb = function (hcg) { default: pure[0] = 1; pure[1] = 0; pure[2] = w; } + /* eslint-enable max-statements-per-line */ mg = (1.0 - c) * g; @@ -7978,11 +7938,11 @@ convert.hcg.rgb = function (hcg) { }; convert.hcg.hsv = function (hcg) { - var c = hcg[1] / 100; - var g = hcg[2] / 100; + const c = hcg[1] / 100; + const g = hcg[2] / 100; - var v = c + g * (1.0 - c); - var f = 0; + const v = c + g * (1.0 - c); + let f = 0; if (v > 0.0) { f = c / v; @@ -7992,11 +7952,11 @@ convert.hcg.hsv = function (hcg) { }; convert.hcg.hsl = function (hcg) { - var c = hcg[1] / 100; - var g = hcg[2] / 100; + const c = hcg[1] / 100; + const g = hcg[2] / 100; - var l = g * (1.0 - c) + 0.5 * c; - var s = 0; + const l = g * (1.0 - c) + 0.5 * c; + let s = 0; if (l > 0.0 && l < 0.5) { s = c / (2 * l); @@ -8009,18 +7969,18 @@ convert.hcg.hsl = function (hcg) { }; convert.hcg.hwb = function (hcg) { - var c = hcg[1] / 100; - var g = hcg[2] / 100; - var v = c + g * (1.0 - c); + const c = hcg[1] / 100; + const g = hcg[2] / 100; + const v = c + g * (1.0 - c); return [hcg[0], (v - c) * 100, (1 - v) * 100]; }; convert.hwb.hcg = function (hwb) { - var w = hwb[1] / 100; - var b = hwb[2] / 100; - var v = 1 - b; - var c = v - w; - var g = 0; + const w = hwb[1] / 100; + const b = hwb[2] / 100; + const v = 1 - b; + const c = v - w; + let g = 0; if (c < 1) { g = (v - c) / (1 - c); @@ -8041,10 +8001,12 @@ convert.gray.rgb = function (args) { return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; }; -convert.gray.hsl = convert.gray.hsv = function (args) { +convert.gray.hsl = function (args) { return [0, 0, args[0]]; }; +convert.gray.hsv = convert.gray.hsl; + convert.gray.hwb = function (gray) { return [0, 100, gray[0]]; }; @@ -8058,21 +8020,21 @@ convert.gray.lab = function (gray) { }; convert.gray.hex = function (gray) { - var val = Math.round(gray[0] / 100 * 255) & 0xFF; - var integer = (val << 16) + (val << 8) + val; + const val = Math.round(gray[0] / 100 * 255) & 0xFF; + const integer = (val << 16) + (val << 8) + val; - var string = integer.toString(16).toUpperCase(); + const string = integer.toString(16).toUpperCase(); return '000000'.substring(string.length) + string; }; convert.rgb.gray = function (rgb) { - var val = (rgb[0] + rgb[1] + rgb[2]) / 3; + const val = (rgb[0] + rgb[1] + rgb[2]) / 3; return [val / 255 * 100]; }; /***/ }), -/* 118 */ +/* 117 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8231,13 +8193,13 @@ module.exports = { /***/ }), -/* 119 */ +/* 118 */ /***/ (function(module, exports, __webpack_require__) { -var conversions = __webpack_require__(117); +const conversions = __webpack_require__(116); /* - this function routes a model to all other models. + This function routes a model to all other models. all functions that are routed have a property `.conversion` attached to the returned synthetic function. This property is an array @@ -8248,11 +8210,11 @@ var conversions = __webpack_require__(117); */ function buildGraph() { - var graph = {}; + const graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3 - var models = Object.keys(conversions); + const models = Object.keys(conversions); - for (var len = models.length, i = 0; i < len; i++) { + for (let len = models.length, i = 0; i < len; i++) { graph[models[i]] = { // http://jsperf.com/1-vs-infinity // micro-opt, but this is simple. @@ -8266,18 +8228,18 @@ function buildGraph() { // https://en.wikipedia.org/wiki/Breadth-first_search function deriveBFS(fromModel) { - var graph = buildGraph(); - var queue = [fromModel]; // unshift -> queue -> pop + const graph = buildGraph(); + const queue = [fromModel]; // Unshift -> queue -> pop graph[fromModel].distance = 0; while (queue.length) { - var current = queue.pop(); - var adjacents = Object.keys(conversions[current]); + const current = queue.pop(); + const adjacents = Object.keys(conversions[current]); - for (var len = adjacents.length, i = 0; i < len; i++) { - var adjacent = adjacents[i]; - var node = graph[adjacent]; + for (let len = adjacents.length, i = 0; i < len; i++) { + const adjacent = adjacents[i]; + const node = graph[adjacent]; if (node.distance === -1) { node.distance = graph[current].distance + 1; @@ -8297,10 +8259,10 @@ function link(from, to) { } function wrapConversion(toModel, graph) { - var path = [graph[toModel].parent, toModel]; - var fn = conversions[graph[toModel].parent][toModel]; + const path = [graph[toModel].parent, toModel]; + let fn = conversions[graph[toModel].parent][toModel]; - var cur = graph[toModel].parent; + let cur = graph[toModel].parent; while (graph[cur].parent) { path.unshift(graph[cur].parent); fn = link(conversions[graph[cur].parent][cur], fn); @@ -8312,16 +8274,16 @@ function wrapConversion(toModel, graph) { } module.exports = function (fromModel) { - var graph = deriveBFS(fromModel); - var conversion = {}; + const graph = deriveBFS(fromModel); + const conversion = {}; - var models = Object.keys(graph); - for (var len = models.length, i = 0; i < len; i++) { - var toModel = models[i]; - var node = graph[toModel]; + const models = Object.keys(graph); + for (let len = models.length, i = 0; i < len; i++) { + const toModel = models[i]; + const node = graph[toModel]; if (node.parent === null) { - // no possible conversion, or this node is the source model. + // No possible conversion, or this node is the source model. continue; } @@ -8334,29 +8296,38 @@ module.exports = function (fromModel) { /***/ }), -/* 120 */ +/* 119 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const os = __webpack_require__(121); +const os = __webpack_require__(120); +const tty = __webpack_require__(121); const hasFlag = __webpack_require__(122); -const env = process.env; +const {env} = process; let forceColor; if (hasFlag('no-color') || hasFlag('no-colors') || - hasFlag('color=false')) { - forceColor = false; + hasFlag('color=false') || + hasFlag('color=never')) { + forceColor = 0; } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) { - forceColor = true; + forceColor = 1; } + if ('FORCE_COLOR' in env) { - forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0; + if (env.FORCE_COLOR === 'true') { + forceColor = 1; + } else if (env.FORCE_COLOR === 'false') { + forceColor = 0; + } else { + forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3); + } } function translateLevel(level) { @@ -8372,8 +8343,8 @@ function translateLevel(level) { }; } -function supportsColor(stream) { - if (forceColor === false) { +function supportsColor(haveStream, streamIsTTY) { + if (forceColor === 0) { return 0; } @@ -8387,26 +8358,21 @@ function supportsColor(stream) { return 2; } - if (stream && !stream.isTTY && forceColor !== true) { - // VS code debugger doesn't have isTTY set - if (env.VSCODE_PID) { - return 1; - } + if (haveStream && !streamIsTTY && forceColor === undefined) { return 0; } - const min = forceColor ? 1 : 0; + const min = forceColor || 0; + + if (env.TERM === 'dumb') { + return min; + } if (process.platform === 'win32') { - // Node.js 7.5.0 is the first version of Node.js to include a patch to - // libuv that enables 256 color output on Windows. Anything earlier and it - // won't work. However, here we target Node.js 8 at minimum as it is an LTS - // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows - // release that supports 256 colors. Windows 10 build 14931 is the first release - // that supports 16m/TrueColor. + // Windows 10 build 10586 is the first Windows release that supports 256 colors. + // Windows 10 build 14931 is the first release that supports 16m/TrueColor. const osRelease = os.release().split('.'); if ( - Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586 ) { @@ -8428,6 +8394,10 @@ function supportsColor(stream) { return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; } + if ('GITHUB_ACTIONS' in env) { + return 1; + } + if (env.COLORTERM === 'truecolor') { return 3; } @@ -8448,7 +8418,7 @@ function supportsColor(stream) { return 2; } - if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { return 1; } @@ -8456,43 +8426,45 @@ function supportsColor(stream) { return 1; } - if (env.TERM === 'dumb') { - return min; - } - return min; } function getSupportLevel(stream) { - const level = supportsColor(stream); + const level = supportsColor(stream, stream && stream.isTTY); return translateLevel(level); } module.exports = { supportsColor: getSupportLevel, - stdout: getSupportLevel(process.stdout), - stderr: getSupportLevel(process.stderr) + stdout: translateLevel(supportsColor(true, tty.isatty(1))), + stderr: translateLevel(supportsColor(true, tty.isatty(2))) }; /***/ }), -/* 121 */ +/* 120 */ /***/ (function(module, exports) { module.exports = require("os"); +/***/ }), +/* 121 */ +/***/ (function(module, exports) { + +module.exports = require("tty"); + /***/ }), /* 122 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -module.exports = (flag, argv) => { - argv = argv || process.argv; + +module.exports = (flag, argv = process.argv) => { const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); - const pos = argv.indexOf(prefix + flag); - const terminatorPos = argv.indexOf('--'); - return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); + const position = argv.indexOf(prefix + flag); + const terminatorPosition = argv.indexOf('--'); + return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); }; @@ -8502,10 +8474,56 @@ module.exports = (flag, argv) => { "use strict"; -const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; + +const stringReplaceAll = (string, substring, replacer) => { + let index = string.indexOf(substring); + if (index === -1) { + return string; + } + + const substringLength = substring.length; + let endIndex = 0; + let returnValue = ''; + do { + returnValue += string.substr(endIndex, index - endIndex) + substring + replacer; + endIndex = index + substringLength; + index = string.indexOf(substring, endIndex); + } while (index !== -1); + + returnValue += string.substr(endIndex); + return returnValue; +}; + +const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => { + let endIndex = 0; + let returnValue = ''; + do { + const gotCR = string[index - 1] === '\r'; + returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix; + endIndex = index + 1; + index = string.indexOf('\n', endIndex); + } while (index !== -1); + + returnValue += string.substr(endIndex); + return returnValue; +}; + +module.exports = { + stringReplaceAll, + stringEncaseCRLFWithFirstIndex +}; + + +/***/ }), +/* 124 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; -const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi; +const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi; const ESCAPES = new Map([ ['n', '\n'], @@ -8521,23 +8539,31 @@ const ESCAPES = new Map([ ]); function unescape(c) { - if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) { + const u = c[0] === 'u'; + const bracket = c[1] === '{'; + + if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) { return String.fromCharCode(parseInt(c.slice(1), 16)); } + if (u && bracket) { + return String.fromCodePoint(parseInt(c.slice(2, -1), 16)); + } + return ESCAPES.get(c) || c; } -function parseArguments(name, args) { +function parseArguments(name, arguments_) { const results = []; - const chunks = args.trim().split(/\s*,\s*/g); + const chunks = arguments_.trim().split(/\s*,\s*/g); let matches; for (const chunk of chunks) { - if (!isNaN(chunk)) { - results.push(Number(chunk)); + const number = Number(chunk); + if (!Number.isNaN(number)) { + results.push(number); } else if ((matches = chunk.match(STRING_REGEX))) { - results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr)); + results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character)); } else { throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); } @@ -8576,36 +8602,34 @@ function buildStyle(chalk, styles) { } let current = chalk; - for (const styleName of Object.keys(enabled)) { - if (Array.isArray(enabled[styleName])) { - if (!(styleName in current)) { - throw new Error(`Unknown Chalk style: ${styleName}`); - } + for (const [styleName, styles] of Object.entries(enabled)) { + if (!Array.isArray(styles)) { + continue; + } - if (enabled[styleName].length > 0) { - current = current[styleName].apply(current, enabled[styleName]); - } else { - current = current[styleName]; - } + if (!(styleName in current)) { + throw new Error(`Unknown Chalk style: ${styleName}`); } + + current = styles.length > 0 ? current[styleName](...styles) : current[styleName]; } return current; } -module.exports = (chalk, tmp) => { +module.exports = (chalk, temporary) => { const styles = []; const chunks = []; let chunk = []; // eslint-disable-next-line max-params - tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => { - if (escapeChar) { - chunk.push(unescape(escapeChar)); + temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => { + if (escapeCharacter) { + chunk.push(unescape(escapeCharacter)); } else if (style) { - const str = chunk.join(''); + const string = chunk.join(''); chunk = []; - chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str)); + chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string)); styles.push({inverse, styles: parseStyle(style)}); } else if (close) { if (styles.length === 0) { @@ -8616,15 +8640,15 @@ module.exports = (chalk, tmp) => { chunk = []; styles.pop(); } else { - chunk.push(chr); + chunk.push(character); } }); chunks.push(chunk.join('')); if (styles.length > 0) { - const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; - throw new Error(errMsg); + const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; + throw new Error(errMessage); } return chunks.join(''); @@ -8632,7 +8656,7 @@ module.exports = (chalk, tmp) => { /***/ }), -/* 124 */ +/* 125 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8689,7 +8713,7 @@ exports.parseLogLevel = parseLogLevel; /***/ }), -/* 125 */ +/* 126 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8733,16 +8757,16 @@ exports.ToolingLogCollectingWriter = ToolingLogCollectingWriter; /***/ }), -/* 126 */ +/* 127 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "commands", function() { return commands; }); -/* harmony import */ var _bootstrap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(127); -/* harmony import */ var _clean__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(280); -/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(389); -/* harmony import */ var _watch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(390); +/* harmony import */ var _bootstrap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(128); +/* harmony import */ var _clean__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(295); +/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(402); +/* harmony import */ var _watch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(403); /* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with @@ -8773,18 +8797,18 @@ const commands = { }; /***/ }), -/* 127 */ +/* 128 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BootstrapCommand", function() { return BootstrapCommand; }); -/* harmony import */ var _utils_link_project_executables__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(128); -/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(142); -/* harmony import */ var _utils_parallelize__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(143); -/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(144); -/* harmony import */ var _utils_project_checksums__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(273); -/* harmony import */ var _utils_bootstrap_cache_file__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(279); +/* harmony import */ var _utils_link_project_executables__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(129); +/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(143); +/* harmony import */ var _utils_parallelize__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(144); +/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(145); +/* harmony import */ var _utils_project_checksums__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(289); +/* harmony import */ var _utils_bootstrap_cache_file__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(294); /* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with @@ -8887,7 +8911,7 @@ const BootstrapCommand = { }; /***/ }), -/* 128 */ +/* 129 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -8895,8 +8919,8 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "linkProjectExecutables", function() { return linkProjectExecutables; }); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(129); -/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(142); +/* harmony import */ var _fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(130); +/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(143); /* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with @@ -8958,7 +8982,7 @@ async function linkProjectExecutables(projectsByName, projectGraph) { } /***/ }), -/* 129 */ +/* 130 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -8972,11 +8996,11 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isDirectory", function() { return isDirectory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isFile", function() { return isFile; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSymlink", function() { return createSymlink; }); -/* harmony import */ var cmd_shim__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(130); +/* harmony import */ var cmd_shim__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(131); /* harmony import */ var cmd_shim__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(cmd_shim__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(132); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(133); /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var ncp__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(141); +/* harmony import */ var ncp__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(142); /* harmony import */ var ncp__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(ncp__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__); @@ -9092,7 +9116,7 @@ async function forceCreate(src, dest, type) { } /***/ }), -/* 130 */ +/* 131 */ /***/ (function(module, exports, __webpack_require__) { // On windows, create a .cmd file. @@ -9108,11 +9132,11 @@ async function forceCreate(src, dest, type) { module.exports = cmdShim cmdShim.ifExists = cmdShimIfExists -var fs = __webpack_require__(131) +var fs = __webpack_require__(132) -var mkdir = __webpack_require__(139) +var mkdir = __webpack_require__(140) , path = __webpack_require__(4) - , toBatchSyntax = __webpack_require__(140) + , toBatchSyntax = __webpack_require__(141) , shebangExpr = /^#\!\s*(?:\/usr\/bin\/env)?\s*([^ \t]+=[^ \t]+\s+)*\s*([^ \t]+)(.*)$/ function cmdShimIfExists (from, to, cb) { @@ -9345,13 +9369,13 @@ function times(n, ok, cb) { /***/ }), -/* 131 */ +/* 132 */ /***/ (function(module, exports, __webpack_require__) { -var fs = __webpack_require__(132) -var polyfills = __webpack_require__(133) -var legacy = __webpack_require__(135) -var clone = __webpack_require__(137) +var fs = __webpack_require__(133) +var polyfills = __webpack_require__(134) +var legacy = __webpack_require__(136) +var clone = __webpack_require__(138) var util = __webpack_require__(111) @@ -9430,7 +9454,7 @@ if (!global[gracefulQueue]) { if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { process.on('exit', function() { debug(global[gracefulQueue]) - __webpack_require__(138).equal(global[gracefulQueue].length, 0) + __webpack_require__(139).equal(global[gracefulQueue].length, 0) }) } } @@ -9697,16 +9721,16 @@ function retry () { /***/ }), -/* 132 */ +/* 133 */ /***/ (function(module, exports) { module.exports = require("fs"); /***/ }), -/* 133 */ +/* 134 */ /***/ (function(module, exports, __webpack_require__) { -var constants = __webpack_require__(134) +var constants = __webpack_require__(135) var origCwd = process.cwd var cwd = null @@ -10051,16 +10075,16 @@ function patch (fs) { /***/ }), -/* 134 */ +/* 135 */ /***/ (function(module, exports) { module.exports = require("constants"); /***/ }), -/* 135 */ +/* 136 */ /***/ (function(module, exports, __webpack_require__) { -var Stream = __webpack_require__(136).Stream +var Stream = __webpack_require__(137).Stream module.exports = legacy @@ -10181,13 +10205,13 @@ function legacy (fs) { /***/ }), -/* 136 */ +/* 137 */ /***/ (function(module, exports) { module.exports = require("stream"); /***/ }), -/* 137 */ +/* 138 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10213,17 +10237,17 @@ function clone (obj) { /***/ }), -/* 138 */ +/* 139 */ /***/ (function(module, exports) { module.exports = require("assert"); /***/ }), -/* 139 */ +/* 140 */ /***/ (function(module, exports, __webpack_require__) { var path = __webpack_require__(4); -var fs = __webpack_require__(132); +var fs = __webpack_require__(133); var _0777 = parseInt('0777', 8); module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; @@ -10324,7 +10348,7 @@ mkdirP.sync = function sync (p, opts, made) { /***/ }), -/* 140 */ +/* 141 */ /***/ (function(module, exports) { exports.replaceDollarWithPercentPair = replaceDollarWithPercentPair @@ -10382,10 +10406,10 @@ function replaceDollarWithPercentPair(value) { /***/ }), -/* 141 */ +/* 142 */ /***/ (function(module, exports, __webpack_require__) { -var fs = __webpack_require__(132), +var fs = __webpack_require__(133), path = __webpack_require__(4); module.exports = ncp; @@ -10649,7 +10673,7 @@ function ncp (source, dest, options, callback) { /***/ }), -/* 142 */ +/* 143 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -10709,7 +10733,7 @@ const log = new Log(); /***/ }), -/* 143 */ +/* 144 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -10775,7 +10799,7 @@ async function parallelize(items, fn, concurrency = 4) { } /***/ }), -/* 144 */ +/* 145 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -10784,15 +10808,15 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildProjectGraph", function() { return buildProjectGraph; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "topologicallyBatchProjects", function() { return topologicallyBatchProjects; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "includeTransitiveProjects", function() { return includeTransitiveProjects; }); -/* harmony import */ var glob__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(145); +/* harmony import */ var glob__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(146); /* harmony import */ var glob__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(glob__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(111); /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(util__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(161); -/* harmony import */ var _project__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(162); -/* harmony import */ var _workspaces__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(271); +/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(162); +/* harmony import */ var _project__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(163); +/* harmony import */ var _workspaces__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(287); /* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with @@ -10991,7 +11015,7 @@ function includeTransitiveProjects(subsetOfProjects, allProjects, { } /***/ }), -/* 145 */ +/* 146 */ /***/ (function(module, exports, __webpack_require__) { // Approach: @@ -11036,27 +11060,27 @@ function includeTransitiveProjects(subsetOfProjects, allProjects, { module.exports = glob -var fs = __webpack_require__(132) -var rp = __webpack_require__(146) -var minimatch = __webpack_require__(148) +var fs = __webpack_require__(133) +var rp = __webpack_require__(147) +var minimatch = __webpack_require__(149) var Minimatch = minimatch.Minimatch -var inherits = __webpack_require__(152) -var EE = __webpack_require__(154).EventEmitter +var inherits = __webpack_require__(153) +var EE = __webpack_require__(155).EventEmitter var path = __webpack_require__(4) -var assert = __webpack_require__(138) -var isAbsolute = __webpack_require__(155) -var globSync = __webpack_require__(156) -var common = __webpack_require__(157) +var assert = __webpack_require__(139) +var isAbsolute = __webpack_require__(156) +var globSync = __webpack_require__(157) +var common = __webpack_require__(158) var alphasort = common.alphasort var alphasorti = common.alphasorti var setopts = common.setopts var ownProp = common.ownProp -var inflight = __webpack_require__(158) +var inflight = __webpack_require__(159) var util = __webpack_require__(111) var childrenIgnored = common.childrenIgnored var isIgnored = common.isIgnored -var once = __webpack_require__(160) +var once = __webpack_require__(161) function glob (pattern, options, cb) { if (typeof options === 'function') cb = options, options = {} @@ -11787,7 +11811,7 @@ Glob.prototype._stat2 = function (f, abs, er, stat, cb) { /***/ }), -/* 146 */ +/* 147 */ /***/ (function(module, exports, __webpack_require__) { module.exports = realpath @@ -11797,13 +11821,13 @@ realpath.realpathSync = realpathSync realpath.monkeypatch = monkeypatch realpath.unmonkeypatch = unmonkeypatch -var fs = __webpack_require__(132) +var fs = __webpack_require__(133) var origRealpath = fs.realpath var origRealpathSync = fs.realpathSync var version = process.version var ok = /^v[0-5]\./.test(version) -var old = __webpack_require__(147) +var old = __webpack_require__(148) function newError (er) { return er && er.syscall === 'realpath' && ( @@ -11859,7 +11883,7 @@ function unmonkeypatch () { /***/ }), -/* 147 */ +/* 148 */ /***/ (function(module, exports, __webpack_require__) { // Copyright Joyent, Inc. and other Node contributors. @@ -11885,7 +11909,7 @@ function unmonkeypatch () { var pathModule = __webpack_require__(4); var isWindows = process.platform === 'win32'; -var fs = __webpack_require__(132); +var fs = __webpack_require__(133); // JavaScript implementation of realpath, ported from node pre-v6 @@ -12168,7 +12192,7 @@ exports.realpath = function realpath(p, cache, cb) { /***/ }), -/* 148 */ +/* 149 */ /***/ (function(module, exports, __webpack_require__) { module.exports = minimatch @@ -12180,7 +12204,7 @@ try { } catch (er) {} var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} -var expand = __webpack_require__(149) +var expand = __webpack_require__(150) var plTypes = { '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, @@ -13097,11 +13121,11 @@ function regExpEscape (s) { /***/ }), -/* 149 */ +/* 150 */ /***/ (function(module, exports, __webpack_require__) { -var concatMap = __webpack_require__(150); -var balanced = __webpack_require__(151); +var concatMap = __webpack_require__(151); +var balanced = __webpack_require__(152); module.exports = expandTop; @@ -13304,7 +13328,7 @@ function expand(str, isTop) { /***/ }), -/* 150 */ +/* 151 */ /***/ (function(module, exports) { module.exports = function (xs, fn) { @@ -13323,7 +13347,7 @@ var isArray = Array.isArray || function (xs) { /***/ }), -/* 151 */ +/* 152 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -13389,7 +13413,7 @@ function range(a, b, str) { /***/ }), -/* 152 */ +/* 153 */ /***/ (function(module, exports, __webpack_require__) { try { @@ -13399,12 +13423,12 @@ try { module.exports = util.inherits; } catch (e) { /* istanbul ignore next */ - module.exports = __webpack_require__(153); + module.exports = __webpack_require__(154); } /***/ }), -/* 153 */ +/* 154 */ /***/ (function(module, exports) { if (typeof Object.create === 'function') { @@ -13437,13 +13461,13 @@ if (typeof Object.create === 'function') { /***/ }), -/* 154 */ +/* 155 */ /***/ (function(module, exports) { module.exports = require("events"); /***/ }), -/* 155 */ +/* 156 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -13470,22 +13494,22 @@ module.exports.win32 = win32; /***/ }), -/* 156 */ +/* 157 */ /***/ (function(module, exports, __webpack_require__) { module.exports = globSync globSync.GlobSync = GlobSync -var fs = __webpack_require__(132) -var rp = __webpack_require__(146) -var minimatch = __webpack_require__(148) +var fs = __webpack_require__(133) +var rp = __webpack_require__(147) +var minimatch = __webpack_require__(149) var Minimatch = minimatch.Minimatch -var Glob = __webpack_require__(145).Glob +var Glob = __webpack_require__(146).Glob var util = __webpack_require__(111) var path = __webpack_require__(4) -var assert = __webpack_require__(138) -var isAbsolute = __webpack_require__(155) -var common = __webpack_require__(157) +var assert = __webpack_require__(139) +var isAbsolute = __webpack_require__(156) +var common = __webpack_require__(158) var alphasort = common.alphasort var alphasorti = common.alphasorti var setopts = common.setopts @@ -13962,7 +13986,7 @@ GlobSync.prototype._makeAbs = function (f) { /***/ }), -/* 157 */ +/* 158 */ /***/ (function(module, exports, __webpack_require__) { exports.alphasort = alphasort @@ -13980,8 +14004,8 @@ function ownProp (obj, field) { } var path = __webpack_require__(4) -var minimatch = __webpack_require__(148) -var isAbsolute = __webpack_require__(155) +var minimatch = __webpack_require__(149) +var isAbsolute = __webpack_require__(156) var Minimatch = minimatch.Minimatch function alphasorti (a, b) { @@ -14208,12 +14232,12 @@ function childrenIgnored (self, path) { /***/ }), -/* 158 */ +/* 159 */ /***/ (function(module, exports, __webpack_require__) { -var wrappy = __webpack_require__(159) +var wrappy = __webpack_require__(160) var reqs = Object.create(null) -var once = __webpack_require__(160) +var once = __webpack_require__(161) module.exports = wrappy(inflight) @@ -14268,7 +14292,7 @@ function slice (args) { /***/ }), -/* 159 */ +/* 160 */ /***/ (function(module, exports) { // Returns a wrapper function that returns a wrapped callback @@ -14307,10 +14331,10 @@ function wrappy (fn, cb) { /***/ }), -/* 160 */ +/* 161 */ /***/ (function(module, exports, __webpack_require__) { -var wrappy = __webpack_require__(159) +var wrappy = __webpack_require__(160) module.exports = wrappy(once) module.exports.strict = wrappy(onceStrict) @@ -14355,7 +14379,7 @@ function onceStrict (fn) { /***/ }), -/* 161 */ +/* 162 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -14388,22 +14412,22 @@ class CliError extends Error { } /***/ }), -/* 162 */ +/* 163 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Project", function() { return Project; }); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(132); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(133); /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(111); /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(util__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(161); -/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(142); -/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(163); -/* harmony import */ var _scripts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(226); +/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(162); +/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(143); +/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(164); +/* harmony import */ var _scripts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(233); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } @@ -14640,7 +14664,7 @@ function normalizePath(path) { } /***/ }), -/* 163 */ +/* 164 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -14648,9 +14672,9 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "readPackageJson", function() { return readPackageJson; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "writePackageJson", function() { return writePackageJson; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isLinkDependency", function() { return isLinkDependency; }); -/* harmony import */ var read_pkg__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(164); +/* harmony import */ var read_pkg__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(165); /* harmony import */ var read_pkg__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(read_pkg__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var write_pkg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(206); +/* harmony import */ var write_pkg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(213); /* harmony import */ var write_pkg__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(write_pkg__WEBPACK_IMPORTED_MODULE_1__); /* * Licensed to Elasticsearch B.V. under one or more contributor @@ -14684,15 +14708,15 @@ function writePackageJson(path, json) { const isLinkDependency = depVersion => depVersion.startsWith('link:'); /***/ }), -/* 164 */ +/* 165 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const {promisify} = __webpack_require__(111); -const fs = __webpack_require__(132); +const fs = __webpack_require__(133); const path = __webpack_require__(4); -const parseJson = __webpack_require__(165); +const parseJson = __webpack_require__(166); const readFileAsync = promisify(fs.readFile); @@ -14707,7 +14731,7 @@ module.exports = async options => { const json = parseJson(await readFileAsync(filePath, 'utf8')); if (options.normalize) { - __webpack_require__(180)(json); + __webpack_require__(187)(json); } return json; @@ -14724,7 +14748,7 @@ module.exports.sync = options => { const json = parseJson(fs.readFileSync(filePath, 'utf8')); if (options.normalize) { - __webpack_require__(180)(json); + __webpack_require__(187)(json); } return json; @@ -14732,15 +14756,15 @@ module.exports.sync = options => { /***/ }), -/* 165 */ +/* 166 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const errorEx = __webpack_require__(166); -const fallback = __webpack_require__(168); -const {default: LinesAndColumns} = __webpack_require__(169); -const {codeFrameColumns} = __webpack_require__(170); +const errorEx = __webpack_require__(167); +const fallback = __webpack_require__(169); +const {default: LinesAndColumns} = __webpack_require__(170); +const {codeFrameColumns} = __webpack_require__(171); const JSONError = errorEx('JSONError', { fileName: errorEx.append('in %s'), @@ -14789,14 +14813,14 @@ module.exports = (string, reviver, filename) => { /***/ }), -/* 166 */ +/* 167 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var util = __webpack_require__(111); -var isArrayish = __webpack_require__(167); +var isArrayish = __webpack_require__(168); var errorEx = function errorEx(name, properties) { if (!name || name.constructor !== String) { @@ -14929,7 +14953,7 @@ module.exports = errorEx; /***/ }), -/* 167 */ +/* 168 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -14946,7 +14970,7 @@ module.exports = function isArrayish(obj) { /***/ }), -/* 168 */ +/* 169 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -14985,7 +15009,7 @@ function parseJson (txt, reviver, context) { /***/ }), -/* 169 */ +/* 170 */ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; @@ -15049,7 +15073,7 @@ var LinesAndColumns = (function () { /***/ }), -/* 170 */ +/* 171 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -15061,7 +15085,7 @@ Object.defineProperty(exports, "__esModule", { exports.codeFrameColumns = codeFrameColumns; exports.default = _default; -var _highlight = _interopRequireWildcard(__webpack_require__(171)); +var _highlight = _interopRequireWildcard(__webpack_require__(172)); function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } @@ -15222,7 +15246,7 @@ function _default(rawLines, lineNumber, colNumber, opts = {}) { } /***/ }), -/* 171 */ +/* 172 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -15235,11 +15259,11 @@ exports.shouldHighlight = shouldHighlight; exports.getChalk = getChalk; exports.default = highlight; -var _jsTokens = _interopRequireWildcard(__webpack_require__(172)); +var _jsTokens = _interopRequireWildcard(__webpack_require__(173)); -var _helperValidatorIdentifier = __webpack_require__(173); +var _helperValidatorIdentifier = __webpack_require__(174); -var _chalk = _interopRequireDefault(__webpack_require__(176)); +var _chalk = _interopRequireDefault(__webpack_require__(177)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -15335,7 +15359,7 @@ function highlight(code, options = {}) { } /***/ }), -/* 172 */ +/* 173 */ /***/ (function(module, exports) { // Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell @@ -15364,7 +15388,7 @@ exports.matchToToken = function(match) { /***/ }), -/* 173 */ +/* 174 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -15422,12 +15446,12 @@ Object.defineProperty(exports, "isKeyword", { } }); -var _identifier = __webpack_require__(174); +var _identifier = __webpack_require__(175); -var _keyword = __webpack_require__(175); +var _keyword = __webpack_require__(176); /***/ }), -/* 174 */ +/* 175 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -15510,7 +15534,7 @@ function isIdentifierName(name) { } /***/ }), -/* 175 */ +/* 176 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -15554,16 +15578,16 @@ function isKeyword(word) { } /***/ }), -/* 176 */ +/* 177 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const escapeStringRegexp = __webpack_require__(113); -const ansiStyles = __webpack_require__(177); -const stdoutColor = __webpack_require__(178).stdout; +const escapeStringRegexp = __webpack_require__(178); +const ansiStyles = __webpack_require__(179); +const stdoutColor = __webpack_require__(184).stdout; -const template = __webpack_require__(179); +const template = __webpack_require__(186); const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); @@ -15789,12 +15813,30 @@ module.exports.default = module.exports; // For TypeScript /***/ }), -/* 177 */ +/* 178 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; + +module.exports = function (str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } + + return str.replace(matchOperatorsRe, '\\$&'); +}; + + +/***/ }), +/* 179 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(module) { -const colorConvert = __webpack_require__(116); +const colorConvert = __webpack_require__(180); const wrapAnsi16 = (fn, offset) => function () { const code = fn.apply(colorConvert, arguments); @@ -15959,3021 +16001,4252 @@ Object.defineProperty(module, 'exports', { get: assembleStyles }); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(115)(module))) +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(114)(module))) /***/ }), -/* 178 */ +/* 180 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +var conversions = __webpack_require__(181); +var route = __webpack_require__(183); -const os = __webpack_require__(121); -const hasFlag = __webpack_require__(122); +var convert = {}; -const env = process.env; +var models = Object.keys(conversions); -let forceColor; -if (hasFlag('no-color') || - hasFlag('no-colors') || - hasFlag('color=false')) { - forceColor = false; -} else if (hasFlag('color') || - hasFlag('colors') || - hasFlag('color=true') || - hasFlag('color=always')) { - forceColor = true; -} -if ('FORCE_COLOR' in env) { - forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0; -} +function wrapRaw(fn) { + var wrappedFn = function (args) { + if (args === undefined || args === null) { + return args; + } -function translateLevel(level) { - if (level === 0) { - return false; - } + if (arguments.length > 1) { + args = Array.prototype.slice.call(arguments); + } - return { - level, - hasBasic: true, - has256: level >= 2, - has16m: level >= 3 + return fn(args); }; -} - -function supportsColor(stream) { - if (forceColor === false) { - return 0; - } - if (hasFlag('color=16m') || - hasFlag('color=full') || - hasFlag('color=truecolor')) { - return 3; + // preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; } - if (hasFlag('color=256')) { - return 2; - } + return wrappedFn; +} - if (stream && !stream.isTTY && forceColor !== true) { - // VS code debugger doesn't have isTTY set - if (env.VSCODE_PID) { - return 1; +function wrapRounded(fn) { + var wrappedFn = function (args) { + if (args === undefined || args === null) { + return args; } - return 0; - } - - const min = forceColor ? 1 : 0; - if (process.platform === 'win32') { - // Node.js 7.5.0 is the first version of Node.js to include a patch to - // libuv that enables 256 color output on Windows. Anything earlier and it - // won't work. However, here we target Node.js 8 at minimum as it is an LTS - // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows - // release that supports 256 colors. Windows 10 build 14931 is the first release - // that supports 16m/TrueColor. - const osRelease = os.release().split('.'); - if ( - Number(process.versions.node.split('.')[0]) >= 8 && - Number(osRelease[0]) >= 10 && - Number(osRelease[2]) >= 10586 - ) { - return Number(osRelease[2]) >= 14931 ? 3 : 2; + if (arguments.length > 1) { + args = Array.prototype.slice.call(arguments); } - return 1; - } + var result = fn(args); - if ('CI' in env) { - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { - return 1; + // we're assuming the result is an array here. + // see notice in conversions.js; don't use box types + // in conversion functions. + if (typeof result === 'object') { + for (var len = result.length, i = 0; i < len; i++) { + result[i] = Math.round(result[i]); + } } - return min; - } - - if ('TEAMCITY_VERSION' in env) { - return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; - } - - if (env.COLORTERM === 'truecolor') { - return 3; - } - - if ('TERM_PROGRAM' in env) { - const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + return result; + }; - switch (env.TERM_PROGRAM) { - case 'iTerm.app': - return version >= 3 ? 3 : 2; - case 'Apple_Terminal': - return 2; - // No default - } + // preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; } - if (/-256(color)?$/i.test(env.TERM)) { - return 2; - } + return wrappedFn; +} - if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { - return 1; - } +models.forEach(function (fromModel) { + convert[fromModel] = {}; - if ('COLORTERM' in env) { - return 1; - } + Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); + Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); - if (env.TERM === 'dumb') { - return min; - } + var routes = route(fromModel); + var routeModels = Object.keys(routes); - return min; -} + routeModels.forEach(function (toModel) { + var fn = routes[toModel]; -function getSupportLevel(stream) { - const level = supportsColor(stream); - return translateLevel(level); -} + convert[fromModel][toModel] = wrapRounded(fn); + convert[fromModel][toModel].raw = wrapRaw(fn); + }); +}); -module.exports = { - supportsColor: getSupportLevel, - stdout: getSupportLevel(process.stdout), - stderr: getSupportLevel(process.stderr) -}; +module.exports = convert; /***/ }), -/* 179 */ +/* 181 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; -const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; -const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; -const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi; +/* MIT license */ +var cssKeywords = __webpack_require__(182); -const ESCAPES = new Map([ - ['n', '\n'], - ['r', '\r'], - ['t', '\t'], - ['b', '\b'], - ['f', '\f'], - ['v', '\v'], - ['0', '\0'], - ['\\', '\\'], - ['e', '\u001B'], - ['a', '\u0007'] -]); +// NOTE: conversions should only return primitive values (i.e. arrays, or +// values that give correct `typeof` results). +// do not use box values types (i.e. Number(), String(), etc.) -function unescape(c) { - if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) { - return String.fromCharCode(parseInt(c.slice(1), 16)); +var reverseKeywords = {}; +for (var key in cssKeywords) { + if (cssKeywords.hasOwnProperty(key)) { + reverseKeywords[cssKeywords[key]] = key; } - - return ESCAPES.get(c) || c; } -function parseArguments(name, args) { - const results = []; - const chunks = args.trim().split(/\s*,\s*/g); - let matches; +var convert = module.exports = { + rgb: {channels: 3, labels: 'rgb'}, + hsl: {channels: 3, labels: 'hsl'}, + hsv: {channels: 3, labels: 'hsv'}, + hwb: {channels: 3, labels: 'hwb'}, + cmyk: {channels: 4, labels: 'cmyk'}, + xyz: {channels: 3, labels: 'xyz'}, + lab: {channels: 3, labels: 'lab'}, + lch: {channels: 3, labels: 'lch'}, + hex: {channels: 1, labels: ['hex']}, + keyword: {channels: 1, labels: ['keyword']}, + ansi16: {channels: 1, labels: ['ansi16']}, + ansi256: {channels: 1, labels: ['ansi256']}, + hcg: {channels: 3, labels: ['h', 'c', 'g']}, + apple: {channels: 3, labels: ['r16', 'g16', 'b16']}, + gray: {channels: 1, labels: ['gray']} +}; - for (const chunk of chunks) { - if (!isNaN(chunk)) { - results.push(Number(chunk)); - } else if ((matches = chunk.match(STRING_REGEX))) { - results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr)); - } else { - throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); +// hide .channels and .labels properties +for (var model in convert) { + if (convert.hasOwnProperty(model)) { + if (!('channels' in convert[model])) { + throw new Error('missing channels property: ' + model); } - } - - return results; -} - -function parseStyle(style) { - STYLE_REGEX.lastIndex = 0; - - const results = []; - let matches; - while ((matches = STYLE_REGEX.exec(style)) !== null) { - const name = matches[1]; + if (!('labels' in convert[model])) { + throw new Error('missing channel labels property: ' + model); + } - if (matches[2]) { - const args = parseArguments(name, matches[2]); - results.push([name].concat(args)); - } else { - results.push([name]); + if (convert[model].labels.length !== convert[model].channels) { + throw new Error('channel and label counts mismatch: ' + model); } - } - return results; + var channels = convert[model].channels; + var labels = convert[model].labels; + delete convert[model].channels; + delete convert[model].labels; + Object.defineProperty(convert[model], 'channels', {value: channels}); + Object.defineProperty(convert[model], 'labels', {value: labels}); + } } -function buildStyle(chalk, styles) { - const enabled = {}; +convert.rgb.hsl = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var min = Math.min(r, g, b); + var max = Math.max(r, g, b); + var delta = max - min; + var h; + var s; + var l; - for (const layer of styles) { - for (const style of layer.styles) { - enabled[style[0]] = layer.inverse ? null : style.slice(1); - } + if (max === min) { + h = 0; + } else if (r === max) { + h = (g - b) / delta; + } else if (g === max) { + h = 2 + (b - r) / delta; + } else if (b === max) { + h = 4 + (r - g) / delta; } - let current = chalk; - for (const styleName of Object.keys(enabled)) { - if (Array.isArray(enabled[styleName])) { - if (!(styleName in current)) { - throw new Error(`Unknown Chalk style: ${styleName}`); - } + h = Math.min(h * 60, 360); - if (enabled[styleName].length > 0) { - current = current[styleName].apply(current, enabled[styleName]); - } else { - current = current[styleName]; - } - } + if (h < 0) { + h += 360; } - return current; -} + l = (min + max) / 2; -module.exports = (chalk, tmp) => { - const styles = []; - const chunks = []; - let chunk = []; + if (max === min) { + s = 0; + } else if (l <= 0.5) { + s = delta / (max + min); + } else { + s = delta / (2 - max - min); + } - // eslint-disable-next-line max-params - tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => { - if (escapeChar) { - chunk.push(unescape(escapeChar)); - } else if (style) { - const str = chunk.join(''); - chunk = []; - chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str)); - styles.push({inverse, styles: parseStyle(style)}); - } else if (close) { - if (styles.length === 0) { - throw new Error('Found extraneous } in Chalk template literal'); - } + return [h, s * 100, l * 100]; +}; - chunks.push(buildStyle(chalk, styles)(chunk.join(''))); - chunk = []; - styles.pop(); - } else { - chunk.push(chr); - } - }); +convert.rgb.hsv = function (rgb) { + var rdif; + var gdif; + var bdif; + var h; + var s; - chunks.push(chunk.join('')); + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var v = Math.max(r, g, b); + var diff = v - Math.min(r, g, b); + var diffc = function (c) { + return (v - c) / 6 / diff + 1 / 2; + }; - if (styles.length > 0) { - const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; - throw new Error(errMsg); + if (diff === 0) { + h = s = 0; + } else { + s = diff / v; + rdif = diffc(r); + gdif = diffc(g); + bdif = diffc(b); + + if (r === v) { + h = bdif - gdif; + } else if (g === v) { + h = (1 / 3) + rdif - bdif; + } else if (b === v) { + h = (2 / 3) + gdif - rdif; + } + if (h < 0) { + h += 1; + } else if (h > 1) { + h -= 1; + } } - return chunks.join(''); + return [ + h * 360, + s * 100, + v * 100 + ]; }; +convert.rgb.hwb = function (rgb) { + var r = rgb[0]; + var g = rgb[1]; + var b = rgb[2]; + var h = convert.rgb.hsl(rgb)[0]; + var w = 1 / 255 * Math.min(r, Math.min(g, b)); -/***/ }), -/* 180 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = normalize + b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); -var fixer = __webpack_require__(181) -normalize.fixer = fixer + return [h, w * 100, b * 100]; +}; -var makeWarning = __webpack_require__(204) +convert.rgb.cmyk = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var c; + var m; + var y; + var k; -var fieldsToFix = ['name','version','description','repository','modules','scripts' - ,'files','bin','man','bugs','keywords','readme','homepage','license'] -var otherThingsToFix = ['dependencies','people', 'typos'] + k = Math.min(1 - r, 1 - g, 1 - b); + c = (1 - r - k) / (1 - k) || 0; + m = (1 - g - k) / (1 - k) || 0; + y = (1 - b - k) / (1 - k) || 0; -var thingsToFix = fieldsToFix.map(function(fieldName) { - return ucFirst(fieldName) + "Field" -}) -// two ways to do this in CoffeeScript on only one line, sub-70 chars: -// thingsToFix = fieldsToFix.map (name) -> ucFirst(name) + "Field" -// thingsToFix = (ucFirst(name) + "Field" for name in fieldsToFix) -thingsToFix = thingsToFix.concat(otherThingsToFix) + return [c * 100, m * 100, y * 100, k * 100]; +}; -function normalize (data, warn, strict) { - if(warn === true) warn = null, strict = true - if(!strict) strict = false - if(!warn || data.private) warn = function(msg) { /* noop */ } - - if (data.scripts && - data.scripts.install === "node-gyp rebuild" && - !data.scripts.preinstall) { - data.gypfile = true - } - fixer.warn = function() { warn(makeWarning.apply(null, arguments)) } - thingsToFix.forEach(function(thingName) { - fixer["fix" + ucFirst(thingName)](data, strict) - }) - data._id = data.name + "@" + data.version +/** + * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance + * */ +function comparativeDistance(x, y) { + return ( + Math.pow(x[0] - y[0], 2) + + Math.pow(x[1] - y[1], 2) + + Math.pow(x[2] - y[2], 2) + ); } -function ucFirst (string) { - return string.charAt(0).toUpperCase() + string.slice(1); -} +convert.rgb.keyword = function (rgb) { + var reversed = reverseKeywords[rgb]; + if (reversed) { + return reversed; + } + var currentClosestDistance = Infinity; + var currentClosestKeyword; -/***/ }), -/* 181 */ -/***/ (function(module, exports, __webpack_require__) { + for (var keyword in cssKeywords) { + if (cssKeywords.hasOwnProperty(keyword)) { + var value = cssKeywords[keyword]; -var semver = __webpack_require__(182) -var validateLicense = __webpack_require__(183); -var hostedGitInfo = __webpack_require__(188) -var isBuiltinModule = __webpack_require__(192).isCore -var depTypes = ["dependencies","devDependencies","optionalDependencies"] -var extractDescription = __webpack_require__(202) -var url = __webpack_require__(189) -var typos = __webpack_require__(203) + // Compute comparative distance + var distance = comparativeDistance(rgb, value); -var fixer = module.exports = { - // default warning function - warn: function() {}, + // Check if its less, if so set as closest + if (distance < currentClosestDistance) { + currentClosestDistance = distance; + currentClosestKeyword = keyword; + } + } + } - fixRepositoryField: function(data) { - if (data.repositories) { - this.warn("repositories"); - data.repository = data.repositories[0] - } - if (!data.repository) return this.warn("missingRepository") - if (typeof data.repository === "string") { - data.repository = { - type: "git", - url: data.repository - } - } - var r = data.repository.url || "" - if (r) { - var hosted = hostedGitInfo.fromUrl(r) - if (hosted) { - r = data.repository.url - = hosted.getDefaultRepresentation() == "shortcut" ? hosted.https() : hosted.toString() - } - } + return currentClosestKeyword; +}; - if (r.match(/github.com\/[^\/]+\/[^\/]+\.git\.git$/)) { - this.warn("brokenGitUrl", r) - } - } +convert.keyword.rgb = function (keyword) { + return cssKeywords[keyword]; +}; -, fixTypos: function(data) { - Object.keys(typos.topLevel).forEach(function (d) { - if (data.hasOwnProperty(d)) { - this.warn("typo", d, typos.topLevel[d]) - } - }, this) - } +convert.rgb.xyz = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; -, fixScriptsField: function(data) { - if (!data.scripts) return - if (typeof data.scripts !== "object") { - this.warn("nonObjectScripts") - delete data.scripts - return - } - Object.keys(data.scripts).forEach(function (k) { - if (typeof data.scripts[k] !== "string") { - this.warn("nonStringScript") - delete data.scripts[k] - } else if (typos.script[k] && !data.scripts[typos.script[k]]) { - this.warn("typo", k, typos.script[k], "scripts") - } - }, this) - } + // assume sRGB + r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92); + g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92); + b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92); -, fixFilesField: function(data) { - var files = data.files - if (files && !Array.isArray(files)) { - this.warn("nonArrayFiles") - delete data.files - } else if (data.files) { - data.files = data.files.filter(function(file) { - if (!file || typeof file !== "string") { - this.warn("invalidFilename", file) - return false - } else { - return true - } - }, this) - } - } + var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); + var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); + var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); -, fixBinField: function(data) { - if (!data.bin) return; - if (typeof data.bin === "string") { - var b = {} - var match - if (match = data.name.match(/^@[^/]+[/](.*)$/)) { - b[match[1]] = data.bin - } else { - b[data.name] = data.bin - } - data.bin = b - } - } + return [x * 100, y * 100, z * 100]; +}; -, fixManField: function(data) { - if (!data.man) return; - if (typeof data.man === "string") { - data.man = [ data.man ] - } - } -, fixBundleDependenciesField: function(data) { - var bdd = "bundledDependencies" - var bd = "bundleDependencies" - if (data[bdd] && !data[bd]) { - data[bd] = data[bdd] - delete data[bdd] - } - if (data[bd] && !Array.isArray(data[bd])) { - this.warn("nonArrayBundleDependencies") - delete data[bd] - } else if (data[bd]) { - data[bd] = data[bd].filter(function(bd) { - if (!bd || typeof bd !== 'string') { - this.warn("nonStringBundleDependency", bd) - return false - } else { - if (!data.dependencies) { - data.dependencies = {} - } - if (!data.dependencies.hasOwnProperty(bd)) { - this.warn("nonDependencyBundleDependency", bd) - data.dependencies[bd] = "*" - } - return true - } - }, this) - } - } +convert.rgb.lab = function (rgb) { + var xyz = convert.rgb.xyz(rgb); + var x = xyz[0]; + var y = xyz[1]; + var z = xyz[2]; + var l; + var a; + var b; -, fixDependencies: function(data, strict) { - var loose = !strict - objectifyDeps(data, this.warn) - addOptionalDepsToDeps(data, this.warn) - this.fixBundleDependenciesField(data) + x /= 95.047; + y /= 100; + z /= 108.883; - ;['dependencies','devDependencies'].forEach(function(deps) { - if (!(deps in data)) return - if (!data[deps] || typeof data[deps] !== "object") { - this.warn("nonObjectDependencies", deps) - delete data[deps] - return - } - Object.keys(data[deps]).forEach(function (d) { - var r = data[deps][d] - if (typeof r !== 'string') { - this.warn("nonStringDependency", d, JSON.stringify(r)) - delete data[deps][d] - } - var hosted = hostedGitInfo.fromUrl(data[deps][d]) - if (hosted) data[deps][d] = hosted.toString() - }, this) - }, this) - } + x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116); -, fixModulesField: function (data) { - if (data.modules) { - this.warn("deprecatedModules") - delete data.modules - } - } + l = (116 * y) - 16; + a = 500 * (x - y); + b = 200 * (y - z); -, fixKeywordsField: function (data) { - if (typeof data.keywords === "string") { - data.keywords = data.keywords.split(/,\s+/) - } - if (data.keywords && !Array.isArray(data.keywords)) { - delete data.keywords - this.warn("nonArrayKeywords") - } else if (data.keywords) { - data.keywords = data.keywords.filter(function(kw) { - if (typeof kw !== "string" || !kw) { - this.warn("nonStringKeyword"); - return false - } else { - return true - } - }, this) - } - } + return [l, a, b]; +}; -, fixVersionField: function(data, strict) { - // allow "loose" semver 1.0 versions in non-strict mode - // enforce strict semver 2.0 compliance in strict mode - var loose = !strict - if (!data.version) { - data.version = "" - return true - } - if (!semver.valid(data.version, loose)) { - throw new Error('Invalid version: "'+ data.version + '"') - } - data.version = semver.clean(data.version, loose) - return true - } +convert.hsl.rgb = function (hsl) { + var h = hsl[0] / 360; + var s = hsl[1] / 100; + var l = hsl[2] / 100; + var t1; + var t2; + var t3; + var rgb; + var val; -, fixPeople: function(data) { - modifyPeople(data, unParsePerson) - modifyPeople(data, parsePerson) - } + if (s === 0) { + val = l * 255; + return [val, val, val]; + } -, fixNameField: function(data, options) { - if (typeof options === "boolean") options = {strict: options} - else if (typeof options === "undefined") options = {} - var strict = options.strict - if (!data.name && !strict) { - data.name = "" - return - } - if (typeof data.name !== "string") { - throw new Error("name field must be a string.") - } - if (!strict) - data.name = data.name.trim() - ensureValidName(data.name, strict, options.allowLegacyCase) - if (isBuiltinModule(data.name)) - this.warn("conflictingName", data.name) - } + if (l < 0.5) { + t2 = l * (1 + s); + } else { + t2 = l + s - l * s; + } + t1 = 2 * l - t2; -, fixDescriptionField: function (data) { - if (data.description && typeof data.description !== 'string') { - this.warn("nonStringDescription") - delete data.description - } - if (data.readme && !data.description) - data.description = extractDescription(data.readme) - if(data.description === undefined) delete data.description; - if (!data.description) this.warn("missingDescription") - } + rgb = [0, 0, 0]; + for (var i = 0; i < 3; i++) { + t3 = h + 1 / 3 * -(i - 1); + if (t3 < 0) { + t3++; + } + if (t3 > 1) { + t3--; + } -, fixReadmeField: function (data) { - if (!data.readme) { - this.warn("missingReadme") - data.readme = "ERROR: No README data found!" - } - } + if (6 * t3 < 1) { + val = t1 + (t2 - t1) * 6 * t3; + } else if (2 * t3 < 1) { + val = t2; + } else if (3 * t3 < 2) { + val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; + } else { + val = t1; + } -, fixBugsField: function(data) { - if (!data.bugs && data.repository && data.repository.url) { - var hosted = hostedGitInfo.fromUrl(data.repository.url) - if(hosted && hosted.bugs()) { - data.bugs = {url: hosted.bugs()} - } - } - else if(data.bugs) { - var emailRe = /^.+@.*\..+$/ - if(typeof data.bugs == "string") { - if(emailRe.test(data.bugs)) - data.bugs = {email:data.bugs} - else if(url.parse(data.bugs).protocol) - data.bugs = {url: data.bugs} - else - this.warn("nonEmailUrlBugsString") - } - else { - bugsTypos(data.bugs, this.warn) - var oldBugs = data.bugs - data.bugs = {} - if(oldBugs.url) { - if(typeof(oldBugs.url) == "string" && url.parse(oldBugs.url).protocol) - data.bugs.url = oldBugs.url - else - this.warn("nonUrlBugsUrlField") - } - if(oldBugs.email) { - if(typeof(oldBugs.email) == "string" && emailRe.test(oldBugs.email)) - data.bugs.email = oldBugs.email - else - this.warn("nonEmailBugsEmailField") - } - } - if(!data.bugs.email && !data.bugs.url) { - delete data.bugs - this.warn("emptyNormalizedBugs") - } - } - } + rgb[i] = val * 255; + } -, fixHomepageField: function(data) { - if (!data.homepage && data.repository && data.repository.url) { - var hosted = hostedGitInfo.fromUrl(data.repository.url) - if (hosted && hosted.docs()) data.homepage = hosted.docs() - } - if (!data.homepage) return + return rgb; +}; - if(typeof data.homepage !== "string") { - this.warn("nonUrlHomepage") - return delete data.homepage - } - if(!url.parse(data.homepage).protocol) { - data.homepage = "http://" + data.homepage - } - } +convert.hsl.hsv = function (hsl) { + var h = hsl[0]; + var s = hsl[1] / 100; + var l = hsl[2] / 100; + var smin = s; + var lmin = Math.max(l, 0.01); + var sv; + var v; -, fixLicenseField: function(data) { - if (!data.license) { - return this.warn("missingLicense") - } else{ - if ( - typeof(data.license) !== 'string' || - data.license.length < 1 || - data.license.trim() === '' - ) { - this.warn("invalidLicense") - } else { - if (!validateLicense(data.license).validForNewPackages) - this.warn("invalidLicense") - } - } - } -} + l *= 2; + s *= (l <= 1) ? l : 2 - l; + smin *= lmin <= 1 ? lmin : 2 - lmin; + v = (l + s) / 2; + sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); -function isValidScopedPackageName(spec) { - if (spec.charAt(0) !== '@') return false + return [h, sv * 100, v * 100]; +}; - var rest = spec.slice(1).split('/') - if (rest.length !== 2) return false +convert.hsv.rgb = function (hsv) { + var h = hsv[0] / 60; + var s = hsv[1] / 100; + var v = hsv[2] / 100; + var hi = Math.floor(h) % 6; - return rest[0] && rest[1] && - rest[0] === encodeURIComponent(rest[0]) && - rest[1] === encodeURIComponent(rest[1]) -} + var f = h - Math.floor(h); + var p = 255 * v * (1 - s); + var q = 255 * v * (1 - (s * f)); + var t = 255 * v * (1 - (s * (1 - f))); + v *= 255; -function isCorrectlyEncodedName(spec) { - return !spec.match(/[\/@\s\+%:]/) && - spec === encodeURIComponent(spec) -} + switch (hi) { + case 0: + return [v, t, p]; + case 1: + return [q, v, p]; + case 2: + return [p, v, t]; + case 3: + return [p, q, v]; + case 4: + return [t, p, v]; + case 5: + return [v, p, q]; + } +}; -function ensureValidName (name, strict, allowLegacyCase) { - if (name.charAt(0) === "." || - !(isValidScopedPackageName(name) || isCorrectlyEncodedName(name)) || - (strict && (!allowLegacyCase) && name !== name.toLowerCase()) || - name.toLowerCase() === "node_modules" || - name.toLowerCase() === "favicon.ico") { - throw new Error("Invalid name: " + JSON.stringify(name)) - } -} +convert.hsv.hsl = function (hsv) { + var h = hsv[0]; + var s = hsv[1] / 100; + var v = hsv[2] / 100; + var vmin = Math.max(v, 0.01); + var lmin; + var sl; + var l; -function modifyPeople (data, fn) { - if (data.author) data.author = fn(data.author) - ;["maintainers", "contributors"].forEach(function (set) { - if (!Array.isArray(data[set])) return; - data[set] = data[set].map(fn) - }) - return data -} + l = (2 - s) * v; + lmin = (2 - s) * vmin; + sl = s * vmin; + sl /= (lmin <= 1) ? lmin : 2 - lmin; + sl = sl || 0; + l /= 2; -function unParsePerson (person) { - if (typeof person === "string") return person - var name = person.name || "" - var u = person.url || person.web - var url = u ? (" ("+u+")") : "" - var e = person.email || person.mail - var email = e ? (" <"+e+">") : "" - return name+email+url -} + return [h, sl * 100, l * 100]; +}; -function parsePerson (person) { - if (typeof person !== "string") return person - var name = person.match(/^([^\(<]+)/) - var url = person.match(/\(([^\)]+)\)/) - var email = person.match(/<([^>]+)>/) - var obj = {} - if (name && name[0].trim()) obj.name = name[0].trim() - if (email) obj.email = email[1]; - if (url) obj.url = url[1]; - return obj -} +// http://dev.w3.org/csswg/css-color/#hwb-to-rgb +convert.hwb.rgb = function (hwb) { + var h = hwb[0] / 360; + var wh = hwb[1] / 100; + var bl = hwb[2] / 100; + var ratio = wh + bl; + var i; + var v; + var f; + var n; -function addOptionalDepsToDeps (data, warn) { - var o = data.optionalDependencies - if (!o) return; - var d = data.dependencies || {} - Object.keys(o).forEach(function (k) { - d[k] = o[k] - }) - data.dependencies = d -} + // wh + bl cant be > 1 + if (ratio > 1) { + wh /= ratio; + bl /= ratio; + } -function depObjectify (deps, type, warn) { - if (!deps) return {} - if (typeof deps === "string") { - deps = deps.trim().split(/[\n\r\s\t ,]+/) - } - if (!Array.isArray(deps)) return deps - warn("deprecatedArrayDependencies", type) - var o = {} - deps.filter(function (d) { - return typeof d === "string" - }).forEach(function(d) { - d = d.trim().split(/(:?[@\s><=])/) - var dn = d.shift() - var dv = d.join("") - dv = dv.trim() - dv = dv.replace(/^@/, "") - o[dn] = dv - }) - return o -} + i = Math.floor(6 * h); + v = 1 - bl; + f = 6 * h - i; -function objectifyDeps (data, warn) { - depTypes.forEach(function (type) { - if (!data[type]) return; - data[type] = depObjectify(data[type], type, warn) - }) -} + if ((i & 0x01) !== 0) { + f = 1 - f; + } -function bugsTypos(bugs, warn) { - if (!bugs) return - Object.keys(bugs).forEach(function (k) { - if (typos.bugs[k]) { - warn("typo", k, typos.bugs[k], "bugs") - bugs[typos.bugs[k]] = bugs[k] - delete bugs[k] - } - }) -} + n = wh + f * (v - wh); // linear interpolation + var r; + var g; + var b; + switch (i) { + default: + case 6: + case 0: r = v; g = n; b = wh; break; + case 1: r = n; g = v; b = wh; break; + case 2: r = wh; g = v; b = n; break; + case 3: r = wh; g = n; b = v; break; + case 4: r = n; g = wh; b = v; break; + case 5: r = v; g = wh; b = n; break; + } -/***/ }), -/* 182 */ -/***/ (function(module, exports) { + return [r * 255, g * 255, b * 255]; +}; -exports = module.exports = SemVer +convert.cmyk.rgb = function (cmyk) { + var c = cmyk[0] / 100; + var m = cmyk[1] / 100; + var y = cmyk[2] / 100; + var k = cmyk[3] / 100; + var r; + var g; + var b; -var debug -/* istanbul ignore next */ -if (typeof process === 'object' && - process.env && - process.env.NODE_DEBUG && - /\bsemver\b/i.test(process.env.NODE_DEBUG)) { - debug = function () { - var args = Array.prototype.slice.call(arguments, 0) - args.unshift('SEMVER') - console.log.apply(console, args) - } -} else { - debug = function () {} -} + r = 1 - Math.min(1, c * (1 - k) + k); + g = 1 - Math.min(1, m * (1 - k) + k); + b = 1 - Math.min(1, y * (1 - k) + k); -// Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. -exports.SEMVER_SPEC_VERSION = '2.0.0' + return [r * 255, g * 255, b * 255]; +}; -var MAX_LENGTH = 256 -var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || - /* istanbul ignore next */ 9007199254740991 +convert.xyz.rgb = function (xyz) { + var x = xyz[0] / 100; + var y = xyz[1] / 100; + var z = xyz[2] / 100; + var r; + var g; + var b; -// Max safe segment length for coercion. -var MAX_SAFE_COMPONENT_LENGTH = 16 + r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); + g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); + b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); -// The actual regexps go on exports.re -var re = exports.re = [] -var src = exports.src = [] -var R = 0 + // assume sRGB + r = r > 0.0031308 + ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055) + : r * 12.92; -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. + g = g > 0.0031308 + ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055) + : g * 12.92; -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. + b = b > 0.0031308 + ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055) + : b * 12.92; -var NUMERICIDENTIFIER = R++ -src[NUMERICIDENTIFIER] = '0|[1-9]\\d*' -var NUMERICIDENTIFIERLOOSE = R++ -src[NUMERICIDENTIFIERLOOSE] = '[0-9]+' + r = Math.min(Math.max(0, r), 1); + g = Math.min(Math.max(0, g), 1); + b = Math.min(Math.max(0, b), 1); -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. + return [r * 255, g * 255, b * 255]; +}; -var NONNUMERICIDENTIFIER = R++ -src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*' +convert.xyz.lab = function (xyz) { + var x = xyz[0]; + var y = xyz[1]; + var z = xyz[2]; + var l; + var a; + var b; -// ## Main Version -// Three dot-separated numeric identifiers. + x /= 95.047; + y /= 100; + z /= 108.883; -var MAINVERSION = R++ -src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + - '(' + src[NUMERICIDENTIFIER] + ')\\.' + - '(' + src[NUMERICIDENTIFIER] + ')' + x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116); -var MAINVERSIONLOOSE = R++ -src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[NUMERICIDENTIFIERLOOSE] + ')' + l = (116 * y) - 16; + a = 500 * (x - y); + b = 200 * (y - z); -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. + return [l, a, b]; +}; -var PRERELEASEIDENTIFIER = R++ -src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + - '|' + src[NONNUMERICIDENTIFIER] + ')' +convert.lab.xyz = function (lab) { + var l = lab[0]; + var a = lab[1]; + var b = lab[2]; + var x; + var y; + var z; -var PRERELEASEIDENTIFIERLOOSE = R++ -src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + - '|' + src[NONNUMERICIDENTIFIER] + ')' + y = (l + 16) / 116; + x = a / 500 + y; + z = y - b / 200; -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. + var y2 = Math.pow(y, 3); + var x2 = Math.pow(x, 3); + var z2 = Math.pow(z, 3); + y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; + x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; + z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; -var PRERELEASE = R++ -src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + - '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))' + x *= 95.047; + y *= 100; + z *= 108.883; -var PRERELEASELOOSE = R++ -src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + - '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))' + return [x, y, z]; +}; -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. +convert.lab.lch = function (lab) { + var l = lab[0]; + var a = lab[1]; + var b = lab[2]; + var hr; + var h; + var c; -var BUILDIDENTIFIER = R++ -src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+' + hr = Math.atan2(b, a); + h = hr * 360 / 2 / Math.PI; -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. + if (h < 0) { + h += 360; + } -var BUILD = R++ -src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + - '(?:\\.' + src[BUILDIDENTIFIER] + ')*))' + c = Math.sqrt(a * a + b * b); -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. + return [l, c, h]; +}; -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. +convert.lch.lab = function (lch) { + var l = lch[0]; + var c = lch[1]; + var h = lch[2]; + var a; + var b; + var hr; -var FULL = R++ -var FULLPLAIN = 'v?' + src[MAINVERSION] + - src[PRERELEASE] + '?' + - src[BUILD] + '?' + hr = h / 360 * 2 * Math.PI; + a = c * Math.cos(hr); + b = c * Math.sin(hr); -src[FULL] = '^' + FULLPLAIN + '$' + return [l, a, b]; +}; -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + - src[PRERELEASELOOSE] + '?' + - src[BUILD] + '?' +convert.rgb.ansi16 = function (args) { + var r = args[0]; + var g = args[1]; + var b = args[2]; + var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization -var LOOSE = R++ -src[LOOSE] = '^' + LOOSEPLAIN + '$' + value = Math.round(value / 50); -var GTLT = R++ -src[GTLT] = '((?:<|>)?=?)' + if (value === 0) { + return 30; + } -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -var XRANGEIDENTIFIERLOOSE = R++ -src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*' -var XRANGEIDENTIFIER = R++ -src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*' + var ansi = 30 + + ((Math.round(b / 255) << 2) + | (Math.round(g / 255) << 1) + | Math.round(r / 255)); -var XRANGEPLAIN = R++ -src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + - '(?:' + src[PRERELEASE] + ')?' + - src[BUILD] + '?' + - ')?)?' + if (value === 2) { + ansi += 60; + } -var XRANGEPLAINLOOSE = R++ -src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:' + src[PRERELEASELOOSE] + ')?' + - src[BUILD] + '?' + - ')?)?' + return ansi; +}; -var XRANGE = R++ -src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$' -var XRANGELOOSE = R++ -src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$' +convert.hsv.ansi16 = function (args) { + // optimization here; we already know the value and don't need to get + // it converted for us. + return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); +}; -// Coercion. -// Extract anything that could conceivably be a part of a valid semver -var COERCE = R++ -src[COERCE] = '(?:^|[^\\d])' + - '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + - '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + - '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + - '(?:$|[^\\d])' +convert.rgb.ansi256 = function (args) { + var r = args[0]; + var g = args[1]; + var b = args[2]; -// Tilde ranges. -// Meaning is "reasonably at or greater than" -var LONETILDE = R++ -src[LONETILDE] = '(?:~>?)' + // we use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + if (r === g && g === b) { + if (r < 8) { + return 16; + } -var TILDETRIM = R++ -src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+' -re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g') -var tildeTrimReplace = '$1~' + if (r > 248) { + return 231; + } -var TILDE = R++ -src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$' -var TILDELOOSE = R++ -src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$' + return Math.round(((r - 8) / 247) * 24) + 232; + } -// Caret ranges. -// Meaning is "at least and backwards compatible with" -var LONECARET = R++ -src[LONECARET] = '(?:\\^)' + var ansi = 16 + + (36 * Math.round(r / 255 * 5)) + + (6 * Math.round(g / 255 * 5)) + + Math.round(b / 255 * 5); -var CARETTRIM = R++ -src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+' -re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g') -var caretTrimReplace = '$1^' + return ansi; +}; -var CARET = R++ -src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$' -var CARETLOOSE = R++ -src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$' +convert.ansi16.rgb = function (args) { + var color = args % 10; -// A simple gt/lt/eq thing, or just "" to indicate "any version" -var COMPARATORLOOSE = R++ -src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$' -var COMPARATOR = R++ -src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$' + // handle greyscale + if (color === 0 || color === 7) { + if (args > 50) { + color += 3.5; + } -// An expression to strip any whitespace between the gtlt and the thing -// it modifies, so that `> 1.2.3` ==> `>1.2.3` -var COMPARATORTRIM = R++ -src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + - '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')' + color = color / 10.5 * 255; -// this one has to use the /g flag -re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g') -var comparatorTrimReplace = '$1$2$3' + return [color, color, color]; + } -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -var HYPHENRANGE = R++ -src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + - '\\s+-\\s+' + - '(' + src[XRANGEPLAIN] + ')' + - '\\s*$' + var mult = (~~(args > 50) + 1) * 0.5; + var r = ((color & 1) * mult) * 255; + var g = (((color >> 1) & 1) * mult) * 255; + var b = (((color >> 2) & 1) * mult) * 255; -var HYPHENRANGELOOSE = R++ -src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + - '\\s+-\\s+' + - '(' + src[XRANGEPLAINLOOSE] + ')' + - '\\s*$' + return [r, g, b]; +}; -// Star ranges basically just allow anything at all. -var STAR = R++ -src[STAR] = '(<|>)?=?\\s*\\*' +convert.ansi256.rgb = function (args) { + // handle greyscale + if (args >= 232) { + var c = (args - 232) * 10 + 8; + return [c, c, c]; + } -// Compile to actual regexp objects. -// All are flag-free, unless they were created above with a flag. -for (var i = 0; i < R; i++) { - debug(i, src[i]) - if (!re[i]) { - re[i] = new RegExp(src[i]) - } -} + args -= 16; -exports.parse = parse -function parse (version, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } + var rem; + var r = Math.floor(args / 36) / 5 * 255; + var g = Math.floor((rem = args % 36) / 6) / 5 * 255; + var b = (rem % 6) / 5 * 255; - if (version instanceof SemVer) { - return version - } + return [r, g, b]; +}; - if (typeof version !== 'string') { - return null - } +convert.rgb.hex = function (args) { + var integer = ((Math.round(args[0]) & 0xFF) << 16) + + ((Math.round(args[1]) & 0xFF) << 8) + + (Math.round(args[2]) & 0xFF); - if (version.length > MAX_LENGTH) { - return null - } + var string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; - var r = options.loose ? re[LOOSE] : re[FULL] - if (!r.test(version)) { - return null - } +convert.hex.rgb = function (args) { + var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); + if (!match) { + return [0, 0, 0]; + } - try { - return new SemVer(version, options) - } catch (er) { - return null - } -} + var colorString = match[0]; -exports.valid = valid -function valid (version, options) { - var v = parse(version, options) - return v ? v.version : null -} + if (match[0].length === 3) { + colorString = colorString.split('').map(function (char) { + return char + char; + }).join(''); + } -exports.clean = clean -function clean (version, options) { - var s = parse(version.trim().replace(/^[=v]+/, ''), options) - return s ? s.version : null -} - -exports.SemVer = SemVer - -function SemVer (version, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - if (version instanceof SemVer) { - if (version.loose === options.loose) { - return version - } else { - version = version.version - } - } else if (typeof version !== 'string') { - throw new TypeError('Invalid Version: ' + version) - } - - if (version.length > MAX_LENGTH) { - throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') - } - - if (!(this instanceof SemVer)) { - return new SemVer(version, options) - } + var integer = parseInt(colorString, 16); + var r = (integer >> 16) & 0xFF; + var g = (integer >> 8) & 0xFF; + var b = integer & 0xFF; - debug('SemVer', version, options) - this.options = options - this.loose = !!options.loose + return [r, g, b]; +}; - var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]) +convert.rgb.hcg = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var max = Math.max(Math.max(r, g), b); + var min = Math.min(Math.min(r, g), b); + var chroma = (max - min); + var grayscale; + var hue; - if (!m) { - throw new TypeError('Invalid Version: ' + version) - } + if (chroma < 1) { + grayscale = min / (1 - chroma); + } else { + grayscale = 0; + } - this.raw = version + if (chroma <= 0) { + hue = 0; + } else + if (max === r) { + hue = ((g - b) / chroma) % 6; + } else + if (max === g) { + hue = 2 + (b - r) / chroma; + } else { + hue = 4 + (r - g) / chroma + 4; + } - // these are actually numbers - this.major = +m[1] - this.minor = +m[2] - this.patch = +m[3] + hue /= 6; + hue %= 1; - if (this.major > MAX_SAFE_INTEGER || this.major < 0) { - throw new TypeError('Invalid major version') - } + return [hue * 360, chroma * 100, grayscale * 100]; +}; - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { - throw new TypeError('Invalid minor version') - } +convert.hsl.hcg = function (hsl) { + var s = hsl[1] / 100; + var l = hsl[2] / 100; + var c = 1; + var f = 0; - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { - throw new TypeError('Invalid patch version') - } + if (l < 0.5) { + c = 2.0 * s * l; + } else { + c = 2.0 * s * (1.0 - l); + } - // numberify any prerelease numeric ids - if (!m[4]) { - this.prerelease = [] - } else { - this.prerelease = m[4].split('.').map(function (id) { - if (/^[0-9]+$/.test(id)) { - var num = +id - if (num >= 0 && num < MAX_SAFE_INTEGER) { - return num - } - } - return id - }) - } + if (c < 1.0) { + f = (l - 0.5 * c) / (1.0 - c); + } - this.build = m[5] ? m[5].split('.') : [] - this.format() -} + return [hsl[0], c * 100, f * 100]; +}; -SemVer.prototype.format = function () { - this.version = this.major + '.' + this.minor + '.' + this.patch - if (this.prerelease.length) { - this.version += '-' + this.prerelease.join('.') - } - return this.version -} +convert.hsv.hcg = function (hsv) { + var s = hsv[1] / 100; + var v = hsv[2] / 100; -SemVer.prototype.toString = function () { - return this.version -} + var c = s * v; + var f = 0; -SemVer.prototype.compare = function (other) { - debug('SemVer.compare', this.version, this.options, other) - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } + if (c < 1.0) { + f = (v - c) / (1 - c); + } - return this.compareMain(other) || this.comparePre(other) -} + return [hsv[0], c * 100, f * 100]; +}; -SemVer.prototype.compareMain = function (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } +convert.hcg.rgb = function (hcg) { + var h = hcg[0] / 360; + var c = hcg[1] / 100; + var g = hcg[2] / 100; - return compareIdentifiers(this.major, other.major) || - compareIdentifiers(this.minor, other.minor) || - compareIdentifiers(this.patch, other.patch) -} + if (c === 0.0) { + return [g * 255, g * 255, g * 255]; + } -SemVer.prototype.comparePre = function (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } + var pure = [0, 0, 0]; + var hi = (h % 1) * 6; + var v = hi % 1; + var w = 1 - v; + var mg = 0; - // NOT having a prerelease is > having one - if (this.prerelease.length && !other.prerelease.length) { - return -1 - } else if (!this.prerelease.length && other.prerelease.length) { - return 1 - } else if (!this.prerelease.length && !other.prerelease.length) { - return 0 - } + switch (Math.floor(hi)) { + case 0: + pure[0] = 1; pure[1] = v; pure[2] = 0; break; + case 1: + pure[0] = w; pure[1] = 1; pure[2] = 0; break; + case 2: + pure[0] = 0; pure[1] = 1; pure[2] = v; break; + case 3: + pure[0] = 0; pure[1] = w; pure[2] = 1; break; + case 4: + pure[0] = v; pure[1] = 0; pure[2] = 1; break; + default: + pure[0] = 1; pure[1] = 0; pure[2] = w; + } - var i = 0 - do { - var a = this.prerelease[i] - var b = other.prerelease[i] - debug('prerelease compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) -} + mg = (1.0 - c) * g; -// preminor will bump the version up to the next minor release, and immediately -// down to pre-release. premajor and prepatch work the same way. -SemVer.prototype.inc = function (release, identifier) { - switch (release) { - case 'premajor': - this.prerelease.length = 0 - this.patch = 0 - this.minor = 0 - this.major++ - this.inc('pre', identifier) - break - case 'preminor': - this.prerelease.length = 0 - this.patch = 0 - this.minor++ - this.inc('pre', identifier) - break - case 'prepatch': - // If this is already a prerelease, it will bump to the next version - // drop any prereleases that might already exist, since they are not - // relevant at this point. - this.prerelease.length = 0 - this.inc('patch', identifier) - this.inc('pre', identifier) - break - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case 'prerelease': - if (this.prerelease.length === 0) { - this.inc('patch', identifier) - } - this.inc('pre', identifier) - break + return [ + (c * pure[0] + mg) * 255, + (c * pure[1] + mg) * 255, + (c * pure[2] + mg) * 255 + ]; +}; - case 'major': - // If this is a pre-major version, bump up to the same major version. - // Otherwise increment major. - // 1.0.0-5 bumps to 1.0.0 - // 1.1.0 bumps to 2.0.0 - if (this.minor !== 0 || - this.patch !== 0 || - this.prerelease.length === 0) { - this.major++ - } - this.minor = 0 - this.patch = 0 - this.prerelease = [] - break - case 'minor': - // If this is a pre-minor version, bump up to the same minor version. - // Otherwise increment minor. - // 1.2.0-5 bumps to 1.2.0 - // 1.2.1 bumps to 1.3.0 - if (this.patch !== 0 || this.prerelease.length === 0) { - this.minor++ - } - this.patch = 0 - this.prerelease = [] - break - case 'patch': - // If this is not a pre-release version, it will increment the patch. - // If it is a pre-release it will bump up to the same patch version. - // 1.2.0-5 patches to 1.2.0 - // 1.2.0 patches to 1.2.1 - if (this.prerelease.length === 0) { - this.patch++ - } - this.prerelease = [] - break - // This probably shouldn't be used publicly. - // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. - case 'pre': - if (this.prerelease.length === 0) { - this.prerelease = [0] - } else { - var i = this.prerelease.length - while (--i >= 0) { - if (typeof this.prerelease[i] === 'number') { - this.prerelease[i]++ - i = -2 - } - } - if (i === -1) { - // didn't increment anything - this.prerelease.push(0) - } - } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - if (this.prerelease[0] === identifier) { - if (isNaN(this.prerelease[1])) { - this.prerelease = [identifier, 0] - } - } else { - this.prerelease = [identifier, 0] - } - } - break +convert.hcg.hsv = function (hcg) { + var c = hcg[1] / 100; + var g = hcg[2] / 100; - default: - throw new Error('invalid increment argument: ' + release) - } - this.format() - this.raw = this.version - return this -} + var v = c + g * (1.0 - c); + var f = 0; -exports.inc = inc -function inc (version, release, loose, identifier) { - if (typeof (loose) === 'string') { - identifier = loose - loose = undefined - } + if (v > 0.0) { + f = c / v; + } - try { - return new SemVer(version, loose).inc(release, identifier).version - } catch (er) { - return null - } -} + return [hcg[0], f * 100, v * 100]; +}; -exports.diff = diff -function diff (version1, version2) { - if (eq(version1, version2)) { - return null - } else { - var v1 = parse(version1) - var v2 = parse(version2) - var prefix = '' - if (v1.prerelease.length || v2.prerelease.length) { - prefix = 'pre' - var defaultResult = 'prerelease' - } - for (var key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return prefix + key - } - } - } - return defaultResult // may be undefined - } -} +convert.hcg.hsl = function (hcg) { + var c = hcg[1] / 100; + var g = hcg[2] / 100; -exports.compareIdentifiers = compareIdentifiers + var l = g * (1.0 - c) + 0.5 * c; + var s = 0; -var numeric = /^[0-9]+$/ -function compareIdentifiers (a, b) { - var anum = numeric.test(a) - var bnum = numeric.test(b) + if (l > 0.0 && l < 0.5) { + s = c / (2 * l); + } else + if (l >= 0.5 && l < 1.0) { + s = c / (2 * (1 - l)); + } - if (anum && bnum) { - a = +a - b = +b - } + return [hcg[0], s * 100, l * 100]; +}; - return a === b ? 0 - : (anum && !bnum) ? -1 - : (bnum && !anum) ? 1 - : a < b ? -1 - : 1 -} +convert.hcg.hwb = function (hcg) { + var c = hcg[1] / 100; + var g = hcg[2] / 100; + var v = c + g * (1.0 - c); + return [hcg[0], (v - c) * 100, (1 - v) * 100]; +}; -exports.rcompareIdentifiers = rcompareIdentifiers -function rcompareIdentifiers (a, b) { - return compareIdentifiers(b, a) -} +convert.hwb.hcg = function (hwb) { + var w = hwb[1] / 100; + var b = hwb[2] / 100; + var v = 1 - b; + var c = v - w; + var g = 0; -exports.major = major -function major (a, loose) { - return new SemVer(a, loose).major -} + if (c < 1) { + g = (v - c) / (1 - c); + } -exports.minor = minor -function minor (a, loose) { - return new SemVer(a, loose).minor -} + return [hwb[0], c * 100, g * 100]; +}; -exports.patch = patch -function patch (a, loose) { - return new SemVer(a, loose).patch -} +convert.apple.rgb = function (apple) { + return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; +}; -exports.compare = compare -function compare (a, b, loose) { - return new SemVer(a, loose).compare(new SemVer(b, loose)) -} +convert.rgb.apple = function (rgb) { + return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; +}; -exports.compareLoose = compareLoose -function compareLoose (a, b) { - return compare(a, b, true) -} +convert.gray.rgb = function (args) { + return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; +}; -exports.rcompare = rcompare -function rcompare (a, b, loose) { - return compare(b, a, loose) -} +convert.gray.hsl = convert.gray.hsv = function (args) { + return [0, 0, args[0]]; +}; -exports.sort = sort -function sort (list, loose) { - return list.sort(function (a, b) { - return exports.compare(a, b, loose) - }) -} +convert.gray.hwb = function (gray) { + return [0, 100, gray[0]]; +}; -exports.rsort = rsort -function rsort (list, loose) { - return list.sort(function (a, b) { - return exports.rcompare(a, b, loose) - }) -} +convert.gray.cmyk = function (gray) { + return [0, 0, 0, gray[0]]; +}; -exports.gt = gt -function gt (a, b, loose) { - return compare(a, b, loose) > 0 -} +convert.gray.lab = function (gray) { + return [gray[0], 0, 0]; +}; -exports.lt = lt -function lt (a, b, loose) { - return compare(a, b, loose) < 0 -} +convert.gray.hex = function (gray) { + var val = Math.round(gray[0] / 100 * 255) & 0xFF; + var integer = (val << 16) + (val << 8) + val; -exports.eq = eq -function eq (a, b, loose) { - return compare(a, b, loose) === 0 -} + var string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; -exports.neq = neq -function neq (a, b, loose) { - return compare(a, b, loose) !== 0 -} +convert.rgb.gray = function (rgb) { + var val = (rgb[0] + rgb[1] + rgb[2]) / 3; + return [val / 255 * 100]; +}; -exports.gte = gte -function gte (a, b, loose) { - return compare(a, b, loose) >= 0 -} -exports.lte = lte -function lte (a, b, loose) { - return compare(a, b, loose) <= 0 -} +/***/ }), +/* 182 */ +/***/ (function(module, exports, __webpack_require__) { -exports.cmp = cmp -function cmp (a, op, b, loose) { - switch (op) { - case '===': - if (typeof a === 'object') - a = a.version - if (typeof b === 'object') - b = b.version - return a === b +"use strict"; + + +module.exports = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] +}; - case '!==': - if (typeof a === 'object') - a = a.version - if (typeof b === 'object') - b = b.version - return a !== b - case '': - case '=': - case '==': - return eq(a, b, loose) +/***/ }), +/* 183 */ +/***/ (function(module, exports, __webpack_require__) { - case '!=': - return neq(a, b, loose) +var conversions = __webpack_require__(181); - case '>': - return gt(a, b, loose) +/* + this function routes a model to all other models. - case '>=': - return gte(a, b, loose) + all functions that are routed have a property `.conversion` attached + to the returned synthetic function. This property is an array + of strings, each with the steps in between the 'from' and 'to' + color models (inclusive). - case '<': - return lt(a, b, loose) + conversions that are not possible simply are not included. +*/ - case '<=': - return lte(a, b, loose) +function buildGraph() { + var graph = {}; + // https://jsperf.com/object-keys-vs-for-in-with-closure/3 + var models = Object.keys(conversions); - default: - throw new TypeError('Invalid operator: ' + op) - } + for (var len = models.length, i = 0; i < len; i++) { + graph[models[i]] = { + // http://jsperf.com/1-vs-infinity + // micro-opt, but this is simple. + distance: -1, + parent: null + }; + } + + return graph; } -exports.Comparator = Comparator -function Comparator (comp, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } +// https://en.wikipedia.org/wiki/Breadth-first_search +function deriveBFS(fromModel) { + var graph = buildGraph(); + var queue = [fromModel]; // unshift -> queue -> pop - if (comp instanceof Comparator) { - if (comp.loose === !!options.loose) { - return comp - } else { - comp = comp.value - } - } + graph[fromModel].distance = 0; - if (!(this instanceof Comparator)) { - return new Comparator(comp, options) - } + while (queue.length) { + var current = queue.pop(); + var adjacents = Object.keys(conversions[current]); - debug('comparator', comp, options) - this.options = options - this.loose = !!options.loose - this.parse(comp) + for (var len = adjacents.length, i = 0; i < len; i++) { + var adjacent = adjacents[i]; + var node = graph[adjacent]; - if (this.semver === ANY) { - this.value = '' - } else { - this.value = this.operator + this.semver.version - } + if (node.distance === -1) { + node.distance = graph[current].distance + 1; + node.parent = current; + queue.unshift(adjacent); + } + } + } - debug('comp', this) + return graph; } -var ANY = {} -Comparator.prototype.parse = function (comp) { - var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR] - var m = comp.match(r) +function link(from, to) { + return function (args) { + return to(from(args)); + }; +} - if (!m) { - throw new TypeError('Invalid comparator: ' + comp) - } +function wrapConversion(toModel, graph) { + var path = [graph[toModel].parent, toModel]; + var fn = conversions[graph[toModel].parent][toModel]; - this.operator = m[1] - if (this.operator === '=') { - this.operator = '' - } + var cur = graph[toModel].parent; + while (graph[cur].parent) { + path.unshift(graph[cur].parent); + fn = link(conversions[graph[cur].parent][cur], fn); + cur = graph[cur].parent; + } - // if it literally is just '>' or '' then allow anything. - if (!m[2]) { - this.semver = ANY - } else { - this.semver = new SemVer(m[2], this.options.loose) - } + fn.conversion = path; + return fn; } -Comparator.prototype.toString = function () { - return this.value -} +module.exports = function (fromModel) { + var graph = deriveBFS(fromModel); + var conversion = {}; -Comparator.prototype.test = function (version) { - debug('Comparator.test', version, this.options.loose) + var models = Object.keys(graph); + for (var len = models.length, i = 0; i < len; i++) { + var toModel = models[i]; + var node = graph[toModel]; - if (this.semver === ANY) { - return true - } + if (node.parent === null) { + // no possible conversion, or this node is the source model. + continue; + } - if (typeof version === 'string') { - version = new SemVer(version, this.options) - } + conversion[toModel] = wrapConversion(toModel, graph); + } - return cmp(version, this.operator, this.semver, this.options) -} + return conversion; +}; -Comparator.prototype.intersects = function (comp, options) { - if (!(comp instanceof Comparator)) { - throw new TypeError('a Comparator is required') - } - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - var rangeTmp +/***/ }), +/* 184 */ +/***/ (function(module, exports, __webpack_require__) { - if (this.operator === '') { - rangeTmp = new Range(comp.value, options) - return satisfies(this.value, rangeTmp, options) - } else if (comp.operator === '') { - rangeTmp = new Range(this.value, options) - return satisfies(comp.semver, rangeTmp, options) - } +"use strict"; - var sameDirectionIncreasing = - (this.operator === '>=' || this.operator === '>') && - (comp.operator === '>=' || comp.operator === '>') - var sameDirectionDecreasing = - (this.operator === '<=' || this.operator === '<') && - (comp.operator === '<=' || comp.operator === '<') - var sameSemVer = this.semver.version === comp.semver.version - var differentDirectionsInclusive = - (this.operator === '>=' || this.operator === '<=') && - (comp.operator === '>=' || comp.operator === '<=') - var oppositeDirectionsLessThan = - cmp(this.semver, '<', comp.semver, options) && - ((this.operator === '>=' || this.operator === '>') && - (comp.operator === '<=' || comp.operator === '<')) - var oppositeDirectionsGreaterThan = - cmp(this.semver, '>', comp.semver, options) && - ((this.operator === '<=' || this.operator === '<') && - (comp.operator === '>=' || comp.operator === '>')) +const os = __webpack_require__(120); +const hasFlag = __webpack_require__(185); - return sameDirectionIncreasing || sameDirectionDecreasing || - (sameSemVer && differentDirectionsInclusive) || - oppositeDirectionsLessThan || oppositeDirectionsGreaterThan +const env = process.env; + +let forceColor; +if (hasFlag('no-color') || + hasFlag('no-colors') || + hasFlag('color=false')) { + forceColor = false; +} else if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { + forceColor = true; +} +if ('FORCE_COLOR' in env) { + forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0; } -exports.Range = Range -function Range (range, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } +function translateLevel(level) { + if (level === 0) { + return false; + } - if (range instanceof Range) { - if (range.loose === !!options.loose && - range.includePrerelease === !!options.includePrerelease) { - return range - } else { - return new Range(range.raw, options) - } - } + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +} - if (range instanceof Comparator) { - return new Range(range.value, options) - } +function supportsColor(stream) { + if (forceColor === false) { + return 0; + } - if (!(this instanceof Range)) { - return new Range(range, options) - } + if (hasFlag('color=16m') || + hasFlag('color=full') || + hasFlag('color=truecolor')) { + return 3; + } - this.options = options - this.loose = !!options.loose - this.includePrerelease = !!options.includePrerelease + if (hasFlag('color=256')) { + return 2; + } - // First, split based on boolean or || - this.raw = range - this.set = range.split(/\s*\|\|\s*/).map(function (range) { - return this.parseRange(range.trim()) - }, this).filter(function (c) { - // throw out any that are not relevant for whatever reason - return c.length - }) + if (stream && !stream.isTTY && forceColor !== true) { + return 0; + } - if (!this.set.length) { - throw new TypeError('Invalid SemVer Range: ' + range) - } + const min = forceColor ? 1 : 0; - this.format() -} + if (process.platform === 'win32') { + // Node.js 7.5.0 is the first version of Node.js to include a patch to + // libuv that enables 256 color output on Windows. Anything earlier and it + // won't work. However, here we target Node.js 8 at minimum as it is an LTS + // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows + // release that supports 256 colors. Windows 10 build 14931 is the first release + // that supports 16m/TrueColor. + const osRelease = os.release().split('.'); + if ( + Number(process.versions.node.split('.')[0]) >= 8 && + Number(osRelease[0]) >= 10 && + Number(osRelease[2]) >= 10586 + ) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } -Range.prototype.format = function () { - this.range = this.set.map(function (comps) { - return comps.join(' ').trim() - }).join('||').trim() - return this.range -} + return 1; + } -Range.prototype.toString = function () { - return this.range -} + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + return 1; + } -Range.prototype.parseRange = function (range) { - var loose = this.options.loose - range = range.trim() - // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE] - range = range.replace(hr, hyphenReplace) - debug('hyphen replace', range) - // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range, re[COMPARATORTRIM]) + return min; + } - // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[TILDETRIM], tildeTrimReplace) + if ('TEAMCITY_VERSION' in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; + } - // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[CARETTRIM], caretTrimReplace) + if (env.COLORTERM === 'truecolor') { + return 3; + } - // normalize spaces - range = range.split(/\s+/).join(' ') + if ('TERM_PROGRAM' in env) { + const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); - // At this point, the range is completely trimmed and - // ready to be split into comparators. + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Apple_Terminal': + return 2; + // No default + } + } - var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR] - var set = range.split(' ').map(function (comp) { - return parseComparator(comp, this.options) - }, this).join(' ').split(/\s+/) - if (this.options.loose) { - // in loose mode, throw out any that are not valid comparators - set = set.filter(function (comp) { - return !!comp.match(compRe) - }) - } - set = set.map(function (comp) { - return new Comparator(comp, this.options) - }, this) + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } - return set -} + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } -Range.prototype.intersects = function (range, options) { - if (!(range instanceof Range)) { - throw new TypeError('a Range is required') - } + if ('COLORTERM' in env) { + return 1; + } - return this.set.some(function (thisComparators) { - return thisComparators.every(function (thisComparator) { - return range.set.some(function (rangeComparators) { - return rangeComparators.every(function (rangeComparator) { - return thisComparator.intersects(rangeComparator, options) - }) - }) - }) - }) -} + if (env.TERM === 'dumb') { + return min; + } -// Mostly just for testing and legacy API reasons -exports.toComparators = toComparators -function toComparators (range, options) { - return new Range(range, options).set.map(function (comp) { - return comp.map(function (c) { - return c.value - }).join(' ').trim().split(' ') - }) + return min; } -// comprised of xranges, tildes, stars, and gtlt's at this point. -// already replaced the hyphen ranges -// turn into a set of JUST comparators. -function parseComparator (comp, options) { - debug('comp', comp, options) - comp = replaceCarets(comp, options) - debug('caret', comp) - comp = replaceTildes(comp, options) - debug('tildes', comp) - comp = replaceXRanges(comp, options) - debug('xrange', comp) - comp = replaceStars(comp, options) - debug('stars', comp) - return comp +function getSupportLevel(stream) { + const level = supportsColor(stream); + return translateLevel(level); } -function isX (id) { - return !id || id.toLowerCase() === 'x' || id === '*' -} +module.exports = { + supportsColor: getSupportLevel, + stdout: getSupportLevel(process.stdout), + stderr: getSupportLevel(process.stderr) +}; -// ~, ~> --> * (any, kinda silly) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 -function replaceTildes (comp, options) { - return comp.trim().split(/\s+/).map(function (comp) { - return replaceTilde(comp, options) - }).join(' ') -} -function replaceTilde (comp, options) { - var r = options.loose ? re[TILDELOOSE] : re[TILDE] - return comp.replace(r, function (_, M, m, p, pr) { - debug('tilde', comp, _, M, m, p, pr) - var ret +/***/ }), +/* 185 */ +/***/ (function(module, exports, __webpack_require__) { - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' - } else if (isX(p)) { - // ~1.2 == >=1.2.0 <1.3.0 - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' - } else if (pr) { - debug('replaceTilde pr', pr) - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + M + '.' + (+m + 1) + '.0' - } else { - // ~1.2.3 == >=1.2.3 <1.3.0 - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + (+m + 1) + '.0' - } +"use strict"; - debug('tilde return', ret) - return ret - }) -} +module.exports = (flag, argv) => { + argv = argv || process.argv; + const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); + const pos = argv.indexOf(prefix + flag); + const terminatorPos = argv.indexOf('--'); + return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); +}; -// ^ --> * (any, kinda silly) -// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 -// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 -// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 -// ^1.2.3 --> >=1.2.3 <2.0.0 -// ^1.2.0 --> >=1.2.0 <2.0.0 -function replaceCarets (comp, options) { - return comp.trim().split(/\s+/).map(function (comp) { - return replaceCaret(comp, options) - }).join(' ') -} -function replaceCaret (comp, options) { - debug('caret', comp, options) - var r = options.loose ? re[CARETLOOSE] : re[CARET] - return comp.replace(r, function (_, M, m, p, pr) { - debug('caret', comp, _, M, m, p, pr) - var ret +/***/ }), +/* 186 */ +/***/ (function(module, exports, __webpack_require__) { - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' - } else if (isX(p)) { - if (M === '0') { - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' - } else { - ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0' - } - } else if (pr) { - debug('replaceCaret pr', pr) - if (M === '0') { - if (m === '0') { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + M + '.' + m + '.' + (+p + 1) - } else { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + M + '.' + (+m + 1) + '.0' - } - } else { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + (+M + 1) + '.0.0' - } - } else { - debug('no pr') - if (M === '0') { - if (m === '0') { - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + m + '.' + (+p + 1) - } else { - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + (+m + 1) + '.0' - } - } else { - ret = '>=' + M + '.' + m + '.' + p + - ' <' + (+M + 1) + '.0.0' - } - } +"use strict"; - debug('caret return', ret) - return ret - }) -} +const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; +const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; +const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; +const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi; -function replaceXRanges (comp, options) { - debug('replaceXRanges', comp, options) - return comp.split(/\s+/).map(function (comp) { - return replaceXRange(comp, options) - }).join(' ') +const ESCAPES = new Map([ + ['n', '\n'], + ['r', '\r'], + ['t', '\t'], + ['b', '\b'], + ['f', '\f'], + ['v', '\v'], + ['0', '\0'], + ['\\', '\\'], + ['e', '\u001B'], + ['a', '\u0007'] +]); + +function unescape(c) { + if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) { + return String.fromCharCode(parseInt(c.slice(1), 16)); + } + + return ESCAPES.get(c) || c; } -function replaceXRange (comp, options) { - comp = comp.trim() - var r = options.loose ? re[XRANGELOOSE] : re[XRANGE] - return comp.replace(r, function (ret, gtlt, M, m, p, pr) { - debug('xRange', comp, ret, gtlt, M, m, p, pr) - var xM = isX(M) - var xm = xM || isX(m) - var xp = xm || isX(p) - var anyX = xp +function parseArguments(name, args) { + const results = []; + const chunks = args.trim().split(/\s*,\s*/g); + let matches; - if (gtlt === '=' && anyX) { - gtlt = '' - } + for (const chunk of chunks) { + if (!isNaN(chunk)) { + results.push(Number(chunk)); + } else if ((matches = chunk.match(STRING_REGEX))) { + results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr)); + } else { + throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); + } + } - if (xM) { - if (gtlt === '>' || gtlt === '<') { - // nothing is allowed - ret = '<0.0.0' - } else { - // nothing is forbidden - ret = '*' - } - } else if (gtlt && anyX) { - // we know patch is an x, because we have any x at all. - // replace X with 0 - if (xm) { - m = 0 - } - p = 0 + return results; +} - if (gtlt === '>') { - // >1 => >=2.0.0 - // >1.2 => >=1.3.0 - // >1.2.3 => >= 1.2.4 - gtlt = '>=' - if (xm) { - M = +M + 1 - m = 0 - p = 0 - } else { - m = +m + 1 - p = 0 - } - } else if (gtlt === '<=') { - // <=0.7.x is actually <0.8.0, since any 0.7.x should - // pass. Similarly, <=7.x is actually <8.0.0, etc. - gtlt = '<' - if (xm) { - M = +M + 1 - } else { - m = +m + 1 - } - } +function parseStyle(style) { + STYLE_REGEX.lastIndex = 0; - ret = gtlt + M + '.' + m + '.' + p - } else if (xm) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' - } else if (xp) { - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' - } + const results = []; + let matches; - debug('xRange return', ret) + while ((matches = STYLE_REGEX.exec(style)) !== null) { + const name = matches[1]; - return ret - }) -} + if (matches[2]) { + const args = parseArguments(name, matches[2]); + results.push([name].concat(args)); + } else { + results.push([name]); + } + } -// Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. -function replaceStars (comp, options) { - debug('replaceStars', comp, options) - // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[STAR], '') + return results; } -// This function is passed to string.replace(re[HYPHENRANGE]) -// M, m, patch, prerelease, build -// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 -// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do -// 1.2 - 3.4 => >=1.2.0 <3.5.0 -function hyphenReplace ($0, - from, fM, fm, fp, fpr, fb, - to, tM, tm, tp, tpr, tb) { - if (isX(fM)) { - from = '' - } else if (isX(fm)) { - from = '>=' + fM + '.0.0' - } else if (isX(fp)) { - from = '>=' + fM + '.' + fm + '.0' - } else { - from = '>=' + from - } +function buildStyle(chalk, styles) { + const enabled = {}; - if (isX(tM)) { - to = '' - } else if (isX(tm)) { - to = '<' + (+tM + 1) + '.0.0' - } else if (isX(tp)) { - to = '<' + tM + '.' + (+tm + 1) + '.0' - } else if (tpr) { - to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr - } else { - to = '<=' + to - } + for (const layer of styles) { + for (const style of layer.styles) { + enabled[style[0]] = layer.inverse ? null : style.slice(1); + } + } - return (from + ' ' + to).trim() + let current = chalk; + for (const styleName of Object.keys(enabled)) { + if (Array.isArray(enabled[styleName])) { + if (!(styleName in current)) { + throw new Error(`Unknown Chalk style: ${styleName}`); + } + + if (enabled[styleName].length > 0) { + current = current[styleName].apply(current, enabled[styleName]); + } else { + current = current[styleName]; + } + } + } + + return current; } -// if ANY of the sets match ALL of its comparators, then pass -Range.prototype.test = function (version) { - if (!version) { - return false - } +module.exports = (chalk, tmp) => { + const styles = []; + const chunks = []; + let chunk = []; - if (typeof version === 'string') { - version = new SemVer(version, this.options) - } + // eslint-disable-next-line max-params + tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => { + if (escapeChar) { + chunk.push(unescape(escapeChar)); + } else if (style) { + const str = chunk.join(''); + chunk = []; + chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str)); + styles.push({inverse, styles: parseStyle(style)}); + } else if (close) { + if (styles.length === 0) { + throw new Error('Found extraneous } in Chalk template literal'); + } - for (var i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version, this.options)) { - return true - } - } - return false -} + chunks.push(buildStyle(chalk, styles)(chunk.join(''))); + chunk = []; + styles.pop(); + } else { + chunk.push(chr); + } + }); -function testSet (set, version, options) { - for (var i = 0; i < set.length; i++) { - if (!set[i].test(version)) { - return false - } - } + chunks.push(chunk.join('')); - if (version.prerelease.length && !options.includePrerelease) { - // Find the set of versions that are allowed to have prereleases - // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 - // That should allow `1.2.3-pr.2` to pass. - // However, `1.2.4-alpha.notready` should NOT be allowed, - // even though it's within the range set by the comparators. - for (i = 0; i < set.length; i++) { - debug(set[i].semver) - if (set[i].semver === ANY) { - continue - } + if (styles.length > 0) { + const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; + throw new Error(errMsg); + } - if (set[i].semver.prerelease.length > 0) { - var allowed = set[i].semver - if (allowed.major === version.major && - allowed.minor === version.minor && - allowed.patch === version.patch) { - return true - } - } - } + return chunks.join(''); +}; - // Version has a -pre, but it's not one of the ones we like. - return false - } - return true -} +/***/ }), +/* 187 */ +/***/ (function(module, exports, __webpack_require__) { -exports.satisfies = satisfies -function satisfies (version, range, options) { - try { - range = new Range(range, options) - } catch (er) { - return false - } - return range.test(version) -} +module.exports = normalize -exports.maxSatisfying = maxSatisfying -function maxSatisfying (versions, range, options) { - var max = null - var maxSV = null - try { - var rangeObj = new Range(range, options) - } catch (er) { - return null +var fixer = __webpack_require__(188) +normalize.fixer = fixer + +var makeWarning = __webpack_require__(211) + +var fieldsToFix = ['name','version','description','repository','modules','scripts' + ,'files','bin','man','bugs','keywords','readme','homepage','license'] +var otherThingsToFix = ['dependencies','people', 'typos'] + +var thingsToFix = fieldsToFix.map(function(fieldName) { + return ucFirst(fieldName) + "Field" +}) +// two ways to do this in CoffeeScript on only one line, sub-70 chars: +// thingsToFix = fieldsToFix.map (name) -> ucFirst(name) + "Field" +// thingsToFix = (ucFirst(name) + "Field" for name in fieldsToFix) +thingsToFix = thingsToFix.concat(otherThingsToFix) + +function normalize (data, warn, strict) { + if(warn === true) warn = null, strict = true + if(!strict) strict = false + if(!warn || data.private) warn = function(msg) { /* noop */ } + + if (data.scripts && + data.scripts.install === "node-gyp rebuild" && + !data.scripts.preinstall) { + data.gypfile = true } - versions.forEach(function (v) { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!max || maxSV.compare(v) === -1) { - // compare(max, v, true) - max = v - maxSV = new SemVer(max, options) - } - } + fixer.warn = function() { warn(makeWarning.apply(null, arguments)) } + thingsToFix.forEach(function(thingName) { + fixer["fix" + ucFirst(thingName)](data, strict) }) - return max + data._id = data.name + "@" + data.version } -exports.minSatisfying = minSatisfying -function minSatisfying (versions, range, options) { - var min = null - var minSV = null - try { - var rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!min || minSV.compare(v) === 1) { - // compare(min, v, true) - min = v - minSV = new SemVer(min, options) - } - } - }) - return min +function ucFirst (string) { + return string.charAt(0).toUpperCase() + string.slice(1); } -exports.minVersion = minVersion -function minVersion (range, loose) { - range = new Range(range, loose) - var minver = new SemVer('0.0.0') - if (range.test(minver)) { - return minver +/***/ }), +/* 188 */ +/***/ (function(module, exports, __webpack_require__) { + +var semver = __webpack_require__(189) +var validateLicense = __webpack_require__(190); +var hostedGitInfo = __webpack_require__(195) +var isBuiltinModule = __webpack_require__(199).isCore +var depTypes = ["dependencies","devDependencies","optionalDependencies"] +var extractDescription = __webpack_require__(209) +var url = __webpack_require__(196) +var typos = __webpack_require__(210) + +var fixer = module.exports = { + // default warning function + warn: function() {}, + + fixRepositoryField: function(data) { + if (data.repositories) { + this.warn("repositories"); + data.repository = data.repositories[0] + } + if (!data.repository) return this.warn("missingRepository") + if (typeof data.repository === "string") { + data.repository = { + type: "git", + url: data.repository + } + } + var r = data.repository.url || "" + if (r) { + var hosted = hostedGitInfo.fromUrl(r) + if (hosted) { + r = data.repository.url + = hosted.getDefaultRepresentation() == "shortcut" ? hosted.https() : hosted.toString() + } + } + + if (r.match(/github.com\/[^\/]+\/[^\/]+\.git\.git$/)) { + this.warn("brokenGitUrl", r) + } } - minver = new SemVer('0.0.0-0') - if (range.test(minver)) { - return minver +, fixTypos: function(data) { + Object.keys(typos.topLevel).forEach(function (d) { + if (data.hasOwnProperty(d)) { + this.warn("typo", d, typos.topLevel[d]) + } + }, this) } - minver = null - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i] +, fixScriptsField: function(data) { + if (!data.scripts) return + if (typeof data.scripts !== "object") { + this.warn("nonObjectScripts") + delete data.scripts + return + } + Object.keys(data.scripts).forEach(function (k) { + if (typeof data.scripts[k] !== "string") { + this.warn("nonStringScript") + delete data.scripts[k] + } else if (typos.script[k] && !data.scripts[typos.script[k]]) { + this.warn("typo", k, typos.script[k], "scripts") + } + }, this) + } - comparators.forEach(function (comparator) { - // Clone to avoid manipulating the comparator's semver object. - var compver = new SemVer(comparator.semver.version) - switch (comparator.operator) { - case '>': - if (compver.prerelease.length === 0) { - compver.patch++ - } else { - compver.prerelease.push(0) - } - compver.raw = compver.format() - /* fallthrough */ - case '': - case '>=': - if (!minver || gt(minver, compver)) { - minver = compver - } - break - case '<': - case '<=': - /* Ignore maximum versions */ - break - /* istanbul ignore next */ - default: - throw new Error('Unexpected operation: ' + comparator.operator) +, fixFilesField: function(data) { + var files = data.files + if (files && !Array.isArray(files)) { + this.warn("nonArrayFiles") + delete data.files + } else if (data.files) { + data.files = data.files.filter(function(file) { + if (!file || typeof file !== "string") { + this.warn("invalidFilename", file) + return false + } else { + return true + } + }, this) + } + } + +, fixBinField: function(data) { + if (!data.bin) return; + if (typeof data.bin === "string") { + var b = {} + var match + if (match = data.name.match(/^@[^/]+[/](.*)$/)) { + b[match[1]] = data.bin + } else { + b[data.name] = data.bin } - }) + data.bin = b + } } - if (minver && range.test(minver)) { - return minver +, fixManField: function(data) { + if (!data.man) return; + if (typeof data.man === "string") { + data.man = [ data.man ] + } + } +, fixBundleDependenciesField: function(data) { + var bdd = "bundledDependencies" + var bd = "bundleDependencies" + if (data[bdd] && !data[bd]) { + data[bd] = data[bdd] + delete data[bdd] + } + if (data[bd] && !Array.isArray(data[bd])) { + this.warn("nonArrayBundleDependencies") + delete data[bd] + } else if (data[bd]) { + data[bd] = data[bd].filter(function(bd) { + if (!bd || typeof bd !== 'string') { + this.warn("nonStringBundleDependency", bd) + return false + } else { + if (!data.dependencies) { + data.dependencies = {} + } + if (!data.dependencies.hasOwnProperty(bd)) { + this.warn("nonDependencyBundleDependency", bd) + data.dependencies[bd] = "*" + } + return true + } + }, this) + } } - return null -} +, fixDependencies: function(data, strict) { + var loose = !strict + objectifyDeps(data, this.warn) + addOptionalDepsToDeps(data, this.warn) + this.fixBundleDependenciesField(data) -exports.validRange = validRange -function validRange (range, options) { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, options).range || '*' - } catch (er) { - return null + ;['dependencies','devDependencies'].forEach(function(deps) { + if (!(deps in data)) return + if (!data[deps] || typeof data[deps] !== "object") { + this.warn("nonObjectDependencies", deps) + delete data[deps] + return + } + Object.keys(data[deps]).forEach(function (d) { + var r = data[deps][d] + if (typeof r !== 'string') { + this.warn("nonStringDependency", d, JSON.stringify(r)) + delete data[deps][d] + } + var hosted = hostedGitInfo.fromUrl(data[deps][d]) + if (hosted) data[deps][d] = hosted.toString() + }, this) + }, this) } -} -// Determine if version is less than all the versions possible in the range -exports.ltr = ltr -function ltr (version, range, options) { - return outside(version, range, '<', options) -} +, fixModulesField: function (data) { + if (data.modules) { + this.warn("deprecatedModules") + delete data.modules + } + } -// Determine if version is greater than all the versions possible in the range. -exports.gtr = gtr -function gtr (version, range, options) { - return outside(version, range, '>', options) -} +, fixKeywordsField: function (data) { + if (typeof data.keywords === "string") { + data.keywords = data.keywords.split(/,\s+/) + } + if (data.keywords && !Array.isArray(data.keywords)) { + delete data.keywords + this.warn("nonArrayKeywords") + } else if (data.keywords) { + data.keywords = data.keywords.filter(function(kw) { + if (typeof kw !== "string" || !kw) { + this.warn("nonStringKeyword"); + return false + } else { + return true + } + }, this) + } + } -exports.outside = outside -function outside (version, range, hilo, options) { - version = new SemVer(version, options) - range = new Range(range, options) +, fixVersionField: function(data, strict) { + // allow "loose" semver 1.0 versions in non-strict mode + // enforce strict semver 2.0 compliance in strict mode + var loose = !strict + if (!data.version) { + data.version = "" + return true + } + if (!semver.valid(data.version, loose)) { + throw new Error('Invalid version: "'+ data.version + '"') + } + data.version = semver.clean(data.version, loose) + return true + } - var gtfn, ltefn, ltfn, comp, ecomp - switch (hilo) { - case '>': - gtfn = gt - ltefn = lte - ltfn = lt - comp = '>' - ecomp = '>=' - break - case '<': - gtfn = lt - ltefn = gte - ltfn = gt - comp = '<' - ecomp = '<=' - break - default: - throw new TypeError('Must provide a hilo val of "<" or ">"') +, fixPeople: function(data) { + modifyPeople(data, unParsePerson) + modifyPeople(data, parsePerson) } - // If it satisifes the range it is not outside - if (satisfies(version, range, options)) { - return false +, fixNameField: function(data, options) { + if (typeof options === "boolean") options = {strict: options} + else if (typeof options === "undefined") options = {} + var strict = options.strict + if (!data.name && !strict) { + data.name = "" + return + } + if (typeof data.name !== "string") { + throw new Error("name field must be a string.") + } + if (!strict) + data.name = data.name.trim() + ensureValidName(data.name, strict, options.allowLegacyCase) + if (isBuiltinModule(data.name)) + this.warn("conflictingName", data.name) } - // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i] +, fixDescriptionField: function (data) { + if (data.description && typeof data.description !== 'string') { + this.warn("nonStringDescription") + delete data.description + } + if (data.readme && !data.description) + data.description = extractDescription(data.readme) + if(data.description === undefined) delete data.description; + if (!data.description) this.warn("missingDescription") + } - var high = null - var low = null +, fixReadmeField: function (data) { + if (!data.readme) { + this.warn("missingReadme") + data.readme = "ERROR: No README data found!" + } + } - comparators.forEach(function (comparator) { - if (comparator.semver === ANY) { - comparator = new Comparator('>=0.0.0') +, fixBugsField: function(data) { + if (!data.bugs && data.repository && data.repository.url) { + var hosted = hostedGitInfo.fromUrl(data.repository.url) + if(hosted && hosted.bugs()) { + data.bugs = {url: hosted.bugs()} } - high = high || comparator - low = low || comparator - if (gtfn(comparator.semver, high.semver, options)) { - high = comparator - } else if (ltfn(comparator.semver, low.semver, options)) { - low = comparator + } + else if(data.bugs) { + var emailRe = /^.+@.*\..+$/ + if(typeof data.bugs == "string") { + if(emailRe.test(data.bugs)) + data.bugs = {email:data.bugs} + else if(url.parse(data.bugs).protocol) + data.bugs = {url: data.bugs} + else + this.warn("nonEmailUrlBugsString") } - }) + else { + bugsTypos(data.bugs, this.warn) + var oldBugs = data.bugs + data.bugs = {} + if(oldBugs.url) { + if(typeof(oldBugs.url) == "string" && url.parse(oldBugs.url).protocol) + data.bugs.url = oldBugs.url + else + this.warn("nonUrlBugsUrlField") + } + if(oldBugs.email) { + if(typeof(oldBugs.email) == "string" && emailRe.test(oldBugs.email)) + data.bugs.email = oldBugs.email + else + this.warn("nonEmailBugsEmailField") + } + } + if(!data.bugs.email && !data.bugs.url) { + delete data.bugs + this.warn("emptyNormalizedBugs") + } + } + } - // If the edge version comparator has a operator then our version - // isn't outside it - if (high.operator === comp || high.operator === ecomp) { - return false +, fixHomepageField: function(data) { + if (!data.homepage && data.repository && data.repository.url) { + var hosted = hostedGitInfo.fromUrl(data.repository.url) + if (hosted && hosted.docs()) data.homepage = hosted.docs() } + if (!data.homepage) return - // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range - if ((!low.operator || low.operator === comp) && - ltefn(version, low.semver)) { - return false - } else if (low.operator === ecomp && ltfn(version, low.semver)) { - return false + if(typeof data.homepage !== "string") { + this.warn("nonUrlHomepage") + return delete data.homepage + } + if(!url.parse(data.homepage).protocol) { + data.homepage = "http://" + data.homepage } } - return true -} -exports.prerelease = prerelease -function prerelease (version, options) { - var parsed = parse(version, options) - return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +, fixLicenseField: function(data) { + if (!data.license) { + return this.warn("missingLicense") + } else{ + if ( + typeof(data.license) !== 'string' || + data.license.length < 1 || + data.license.trim() === '' + ) { + this.warn("invalidLicense") + } else { + if (!validateLicense(data.license).validForNewPackages) + this.warn("invalidLicense") + } + } + } } -exports.intersects = intersects -function intersects (r1, r2, options) { - r1 = new Range(r1, options) - r2 = new Range(r2, options) - return r1.intersects(r2) -} +function isValidScopedPackageName(spec) { + if (spec.charAt(0) !== '@') return false -exports.coerce = coerce -function coerce (version) { - if (version instanceof SemVer) { - return version - } + var rest = spec.slice(1).split('/') + if (rest.length !== 2) return false - if (typeof version !== 'string') { - return null - } + return rest[0] && rest[1] && + rest[0] === encodeURIComponent(rest[0]) && + rest[1] === encodeURIComponent(rest[1]) +} - var match = version.match(re[COERCE]) +function isCorrectlyEncodedName(spec) { + return !spec.match(/[\/@\s\+%:]/) && + spec === encodeURIComponent(spec) +} - if (match == null) { - return null +function ensureValidName (name, strict, allowLegacyCase) { + if (name.charAt(0) === "." || + !(isValidScopedPackageName(name) || isCorrectlyEncodedName(name)) || + (strict && (!allowLegacyCase) && name !== name.toLowerCase()) || + name.toLowerCase() === "node_modules" || + name.toLowerCase() === "favicon.ico") { + throw new Error("Invalid name: " + JSON.stringify(name)) } - - return parse(match[1] + - '.' + (match[2] || '0') + - '.' + (match[3] || '0')) } +function modifyPeople (data, fn) { + if (data.author) data.author = fn(data.author) + ;["maintainers", "contributors"].forEach(function (set) { + if (!Array.isArray(data[set])) return; + data[set] = data[set].map(fn) + }) + return data +} -/***/ }), -/* 183 */ -/***/ (function(module, exports, __webpack_require__) { - -var parse = __webpack_require__(184); -var correct = __webpack_require__(186); - -var genericWarning = ( - 'license should be ' + - 'a valid SPDX license expression (without "LicenseRef"), ' + - '"UNLICENSED", or ' + - '"SEE LICENSE IN "' -); +function unParsePerson (person) { + if (typeof person === "string") return person + var name = person.name || "" + var u = person.url || person.web + var url = u ? (" ("+u+")") : "" + var e = person.email || person.mail + var email = e ? (" <"+e+">") : "" + return name+email+url +} -var fileReferenceRE = /^SEE LICEN[CS]E IN (.+)$/; +function parsePerson (person) { + if (typeof person !== "string") return person + var name = person.match(/^([^\(<]+)/) + var url = person.match(/\(([^\)]+)\)/) + var email = person.match(/<([^>]+)>/) + var obj = {} + if (name && name[0].trim()) obj.name = name[0].trim() + if (email) obj.email = email[1]; + if (url) obj.url = url[1]; + return obj +} -function startsWith(prefix, string) { - return string.slice(0, prefix.length) === prefix; +function addOptionalDepsToDeps (data, warn) { + var o = data.optionalDependencies + if (!o) return; + var d = data.dependencies || {} + Object.keys(o).forEach(function (k) { + d[k] = o[k] + }) + data.dependencies = d } -function usesLicenseRef(ast) { - if (ast.hasOwnProperty('license')) { - var license = ast.license; - return ( - startsWith('LicenseRef', license) || - startsWith('DocumentRef', license) - ); - } else { - return ( - usesLicenseRef(ast.left) || - usesLicenseRef(ast.right) - ); +function depObjectify (deps, type, warn) { + if (!deps) return {} + if (typeof deps === "string") { + deps = deps.trim().split(/[\n\r\s\t ,]+/) } + if (!Array.isArray(deps)) return deps + warn("deprecatedArrayDependencies", type) + var o = {} + deps.filter(function (d) { + return typeof d === "string" + }).forEach(function(d) { + d = d.trim().split(/(:?[@\s><=])/) + var dn = d.shift() + var dv = d.join("") + dv = dv.trim() + dv = dv.replace(/^@/, "") + o[dn] = dv + }) + return o } -module.exports = function(argument) { - var ast; +function objectifyDeps (data, warn) { + depTypes.forEach(function (type) { + if (!data[type]) return; + data[type] = depObjectify(data[type], type, warn) + }) +} - try { - ast = parse(argument); - } catch (e) { - var match - if ( - argument === 'UNLICENSED' || - argument === 'UNLICENCED' - ) { - return { - validForOldPackages: true, - validForNewPackages: true, - unlicensed: true - }; - } else if (match = fileReferenceRE.exec(argument)) { - return { - validForOldPackages: true, - validForNewPackages: true, - inFile: match[1] - }; - } else { - var result = { - validForOldPackages: false, - validForNewPackages: false, - warnings: [genericWarning] - }; - var corrected = correct(argument); - if (corrected) { - result.warnings.push( - 'license is similar to the valid expression "' + corrected + '"' - ); - } - return result; +function bugsTypos(bugs, warn) { + if (!bugs) return + Object.keys(bugs).forEach(function (k) { + if (typos.bugs[k]) { + warn("typo", k, typos.bugs[k], "bugs") + bugs[typos.bugs[k]] = bugs[k] + delete bugs[k] } - } - - if (usesLicenseRef(ast)) { - return { - validForNewPackages: false, - validForOldPackages: false, - spdx: true, - warnings: [genericWarning] - }; - } else { - return { - validForNewPackages: true, - validForOldPackages: true, - spdx: true - }; - } -}; + }) +} /***/ }), -/* 184 */ -/***/ (function(module, exports, __webpack_require__) { +/* 189 */ +/***/ (function(module, exports) { -var parser = __webpack_require__(185).parser +exports = module.exports = SemVer -module.exports = function (argument) { - return parser.parse(argument) +var debug +/* istanbul ignore next */ +if (typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG)) { + debug = function () { + var args = Array.prototype.slice.call(arguments, 0) + args.unshift('SEMVER') + console.log.apply(console, args) + } +} else { + debug = function () {} } +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +exports.SEMVER_SPEC_VERSION = '2.0.0' -/***/ }), -/* 185 */ -/***/ (function(module, exports, __webpack_require__) { +var MAX_LENGTH = 256 +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || + /* istanbul ignore next */ 9007199254740991 -/* WEBPACK VAR INJECTION */(function(module) {/* parser generated by jison 0.4.17 */ -/* - Returns a Parser object of the following structure: +// Max safe segment length for coercion. +var MAX_SAFE_COMPONENT_LENGTH = 16 - Parser: { - yy: {} - } +// The actual regexps go on exports.re +var re = exports.re = [] +var src = exports.src = [] +var R = 0 - Parser.prototype: { - yy: {}, - trace: function(), - symbols_: {associative list: name ==> number}, - terminals_: {associative list: number ==> name}, - productions_: [...], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), - table: [...], - defaultActions: {...}, - parseError: function(str, hash), - parse: function(input), +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. - lexer: { - EOF: 1, - parseError: function(str, hash), - setInput: function(input), - input: function(), - unput: function(str), - more: function(), - less: function(n), - pastInput: function(), - upcomingInput: function(), - showPosition: function(), - test_match: function(regex_match_array, rule_index), - next: function(), - lex: function(), - begin: function(condition), - popState: function(), - _currentRules: function(), - topState: function(), - pushState: function(condition), +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. - options: { - ranges: boolean (optional: true ==> token location info will include a .range[] member) - flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) - backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) - }, +var NUMERICIDENTIFIER = R++ +src[NUMERICIDENTIFIER] = '0|[1-9]\\d*' +var NUMERICIDENTIFIERLOOSE = R++ +src[NUMERICIDENTIFIERLOOSE] = '[0-9]+' - performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), - rules: [...], - conditions: {associative list: name ==> set}, - } - } +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. +var NONNUMERICIDENTIFIER = R++ +src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*' - token location info (@$, _$, etc.): { - first_line: n, - last_line: n, - first_column: n, - last_column: n, - range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) - } +// ## Main Version +// Three dot-separated numeric identifiers. +var MAINVERSION = R++ +src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')' - the parseError function receives a 'hash' object with these members for lexer and parser errors: { - text: (matched text) - token: (the produced terminal token, if any) - line: (yylineno) - } - while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { - loc: (yylloc) - expected: (string describing the set of expected tokens) - recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) - } -*/ -var spdxparse = (function(){ -var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,5],$V1=[1,6],$V2=[1,7],$V3=[1,4],$V4=[1,9],$V5=[1,10],$V6=[5,14,15,17],$V7=[5,12,14,15,17]; -var parser = {trace: function trace() { }, -yy: {}, -symbols_: {"error":2,"start":3,"expression":4,"EOS":5,"simpleExpression":6,"LICENSE":7,"PLUS":8,"LICENSEREF":9,"DOCUMENTREF":10,"COLON":11,"WITH":12,"EXCEPTION":13,"AND":14,"OR":15,"OPEN":16,"CLOSE":17,"$accept":0,"$end":1}, -terminals_: {2:"error",5:"EOS",7:"LICENSE",8:"PLUS",9:"LICENSEREF",10:"DOCUMENTREF",11:"COLON",12:"WITH",13:"EXCEPTION",14:"AND",15:"OR",16:"OPEN",17:"CLOSE"}, -productions_: [0,[3,2],[6,1],[6,2],[6,1],[6,3],[4,1],[4,3],[4,3],[4,3],[4,3]], -performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { -/* this == yyval */ +var MAINVERSIONLOOSE = R++ +src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')' -var $0 = $$.length - 1; -switch (yystate) { -case 1: -return this.$ = $$[$0-1] -break; -case 2: case 4: case 5: -this.$ = {license: yytext} -break; -case 3: -this.$ = {license: $$[$0-1], plus: true} -break; -case 6: -this.$ = $$[$0] -break; -case 7: -this.$ = {exception: $$[$0]} -this.$.license = $$[$0-2].license -if ($$[$0-2].hasOwnProperty('plus')) { - this.$.plus = $$[$0-2].plus -} -break; -case 8: -this.$ = {conjunction: 'and', left: $$[$0-2], right: $$[$0]} -break; -case 9: -this.$ = {conjunction: 'or', left: $$[$0-2], right: $$[$0]} -break; -case 10: -this.$ = $$[$0-1] -break; -} -}, -table: [{3:1,4:2,6:3,7:$V0,9:$V1,10:$V2,16:$V3},{1:[3]},{5:[1,8],14:$V4,15:$V5},o($V6,[2,6],{12:[1,11]}),{4:12,6:3,7:$V0,9:$V1,10:$V2,16:$V3},o($V7,[2,2],{8:[1,13]}),o($V7,[2,4]),{11:[1,14]},{1:[2,1]},{4:15,6:3,7:$V0,9:$V1,10:$V2,16:$V3},{4:16,6:3,7:$V0,9:$V1,10:$V2,16:$V3},{13:[1,17]},{14:$V4,15:$V5,17:[1,18]},o($V7,[2,3]),{9:[1,19]},o($V6,[2,8]),o([5,15,17],[2,9],{14:$V4}),o($V6,[2,7]),o($V6,[2,10]),o($V7,[2,5])], -defaultActions: {8:[2,1]}, -parseError: function parseError(str, hash) { - if (hash.recoverable) { - this.trace(str); - } else { - function _parseError (msg, hash) { - this.message = msg; - this.hash = hash; - } - _parseError.prototype = Error; +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. - throw new _parseError(str, hash); - } -}, -parse: function parse(input) { - var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; - var args = lstack.slice.call(arguments, 1); - var lexer = Object.create(this.lexer); - var sharedState = { yy: {} }; - for (var k in this.yy) { - if (Object.prototype.hasOwnProperty.call(this.yy, k)) { - sharedState.yy[k] = this.yy[k]; - } - } - lexer.setInput(input, sharedState.yy); - sharedState.yy.lexer = lexer; - sharedState.yy.parser = this; - if (typeof lexer.yylloc == 'undefined') { - lexer.yylloc = {}; - } - var yyloc = lexer.yylloc; - lstack.push(yyloc); - var ranges = lexer.options && lexer.options.ranges; - if (typeof sharedState.yy.parseError === 'function') { - this.parseError = sharedState.yy.parseError; - } else { - this.parseError = Object.getPrototypeOf(this).parseError; - } - function popStack(n) { - stack.length = stack.length - 2 * n; - vstack.length = vstack.length - n; - lstack.length = lstack.length - n; - } - _token_stack: - var lex = function () { - var token; - token = lexer.lex() || EOF; - if (typeof token !== 'number') { - token = self.symbols_[token] || token; - } - return token; - }; - var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; - while (true) { - state = stack[stack.length - 1]; - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || typeof symbol == 'undefined') { - symbol = lex(); - } - action = table[state] && table[state][symbol]; - } - if (typeof action === 'undefined' || !action.length || !action[0]) { - var errStr = ''; - expected = []; - for (p in table[state]) { - if (this.terminals_[p] && p > TERROR) { - expected.push('\'' + this.terminals_[p] + '\''); - } - } - if (lexer.showPosition) { - errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; - } else { - errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); - } - this.parseError(errStr, { - text: lexer.match, - token: this.terminals_[symbol] || symbol, - line: lexer.yylineno, - loc: yyloc, - expected: expected - }); - } - if (action[0] instanceof Array && action.length > 1) { - throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); - } - switch (action[0]) { - case 1: - stack.push(symbol); - vstack.push(lexer.yytext); - lstack.push(lexer.yylloc); - stack.push(action[1]); - symbol = null; - if (!preErrorSymbol) { - yyleng = lexer.yyleng; - yytext = lexer.yytext; - yylineno = lexer.yylineno; - yyloc = lexer.yylloc; - if (recovering > 0) { - recovering--; - } - } else { - symbol = preErrorSymbol; - preErrorSymbol = null; - } - break; - case 2: - len = this.productions_[action[1]][1]; - yyval.$ = vstack[vstack.length - len]; - yyval._$ = { - first_line: lstack[lstack.length - (len || 1)].first_line, - last_line: lstack[lstack.length - 1].last_line, - first_column: lstack[lstack.length - (len || 1)].first_column, - last_column: lstack[lstack.length - 1].last_column - }; - if (ranges) { - yyval._$.range = [ - lstack[lstack.length - (len || 1)].range[0], - lstack[lstack.length - 1].range[1] - ]; - } - r = this.performAction.apply(yyval, [ - yytext, - yyleng, - yylineno, - sharedState.yy, - action[1], - vstack, - lstack - ].concat(args)); - if (typeof r !== 'undefined') { - return r; - } - if (len) { - stack = stack.slice(0, -1 * len * 2); - vstack = vstack.slice(0, -1 * len); - lstack = lstack.slice(0, -1 * len); - } - stack.push(this.productions_[action[1]][0]); - vstack.push(yyval.$); - lstack.push(yyval._$); - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; - stack.push(newState); - break; - case 3: - return true; - } - } - return true; -}}; -/* generated by jison-lex 0.3.4 */ -var lexer = (function(){ -var lexer = ({ +var PRERELEASEIDENTIFIER = R++ +src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + + '|' + src[NONNUMERICIDENTIFIER] + ')' -EOF:1, +var PRERELEASEIDENTIFIERLOOSE = R++ +src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + + '|' + src[NONNUMERICIDENTIFIER] + ')' -parseError:function parseError(str, hash) { - if (this.yy.parser) { - this.yy.parser.parseError(str, hash); - } else { - throw new Error(str); - } - }, +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. -// resets the lexer, sets new input -setInput:function (input, yy) { - this.yy = yy || this.yy || {}; - this._input = input; - this._more = this._backtrack = this.done = false; - this.yylineno = this.yyleng = 0; - this.yytext = this.matched = this.match = ''; - this.conditionStack = ['INITIAL']; - this.yylloc = { - first_line: 1, - first_column: 0, - last_line: 1, - last_column: 0 - }; - if (this.options.ranges) { - this.yylloc.range = [0,0]; - } - this.offset = 0; - return this; - }, +var PRERELEASE = R++ +src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + + '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))' -// consumes and returns one char from the input -input:function () { - var ch = this._input[0]; - this.yytext += ch; - this.yyleng++; - this.offset++; - this.match += ch; - this.matched += ch; - var lines = ch.match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno++; - this.yylloc.last_line++; - } else { - this.yylloc.last_column++; - } - if (this.options.ranges) { - this.yylloc.range[1]++; - } +var PRERELEASELOOSE = R++ +src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + + '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))' - this._input = this._input.slice(1); - return ch; - }, +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. -// unshifts one char (or a string) into the input -unput:function (ch) { - var len = ch.length; - var lines = ch.split(/(?:\r\n?|\n)/g); +var BUILDIDENTIFIER = R++ +src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+' - this._input = ch + this._input; - this.yytext = this.yytext.substr(0, this.yytext.length - len); - //this.yyleng -= len; - this.offset -= len; - var oldLines = this.match.split(/(?:\r\n?|\n)/g); - this.match = this.match.substr(0, this.match.length - 1); - this.matched = this.matched.substr(0, this.matched.length - 1); +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. - if (lines.length - 1) { - this.yylineno -= lines.length - 1; - } - var r = this.yylloc.range; +var BUILD = R++ +src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + + '(?:\\.' + src[BUILDIDENTIFIER] + ')*))' - this.yylloc = { - first_line: this.yylloc.first_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.first_column, - last_column: lines ? - (lines.length === oldLines.length ? this.yylloc.first_column : 0) - + oldLines[oldLines.length - lines.length].length - lines[0].length : - this.yylloc.first_column - len - }; +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. - if (this.options.ranges) { - this.yylloc.range = [r[0], r[0] + this.yyleng - len]; - } - this.yyleng = this.yytext.length; - return this; - }, +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. -// When called from action, caches matched text and appends it on next action -more:function () { - this._more = true; - return this; - }, +var FULL = R++ +var FULLPLAIN = 'v?' + src[MAINVERSION] + + src[PRERELEASE] + '?' + + src[BUILD] + '?' -// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. -reject:function () { - if (this.options.backtrack_lexer) { - this._backtrack = true; - } else { - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { - text: "", - token: null, - line: this.yylineno - }); +src[FULL] = '^' + FULLPLAIN + '$' - } - return this; - }, +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + + src[PRERELEASELOOSE] + '?' + + src[BUILD] + '?' -// retain first n characters of the match -less:function (n) { - this.unput(this.match.slice(n)); - }, +var LOOSE = R++ +src[LOOSE] = '^' + LOOSEPLAIN + '$' -// displays already matched input, i.e. for error messages -pastInput:function () { - var past = this.matched.substr(0, this.matched.length - this.match.length); - return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); - }, +var GTLT = R++ +src[GTLT] = '((?:<|>)?=?)' -// displays upcoming input, i.e. for error messages -upcomingInput:function () { - var next = this.match; - if (next.length < 20) { - next += this._input.substr(0, 20-next.length); - } - return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); - }, +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +var XRANGEIDENTIFIERLOOSE = R++ +src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*' +var XRANGEIDENTIFIER = R++ +src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*' -// displays the character position where the lexing error occurred, i.e. for error messages -showPosition:function () { - var pre = this.pastInput(); - var c = new Array(pre.length + 1).join("-"); - return pre + this.upcomingInput() + "\n" + c + "^"; - }, +var XRANGEPLAIN = R++ +src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:' + src[PRERELEASE] + ')?' + + src[BUILD] + '?' + + ')?)?' -// test the lexed token: return FALSE when not a match, otherwise return token -test_match:function (match, indexed_rule) { - var token, - lines, - backup; +var XRANGEPLAINLOOSE = R++ +src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:' + src[PRERELEASELOOSE] + ')?' + + src[BUILD] + '?' + + ')?)?' - if (this.options.backtrack_lexer) { - // save context - backup = { - yylineno: this.yylineno, - yylloc: { - first_line: this.yylloc.first_line, - last_line: this.last_line, - first_column: this.yylloc.first_column, - last_column: this.yylloc.last_column - }, - yytext: this.yytext, - match: this.match, - matches: this.matches, - matched: this.matched, - yyleng: this.yyleng, - offset: this.offset, - _more: this._more, - _input: this._input, - yy: this.yy, - conditionStack: this.conditionStack.slice(0), - done: this.done - }; - if (this.options.ranges) { - backup.yylloc.range = this.yylloc.range.slice(0); - } - } +var XRANGE = R++ +src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$' +var XRANGELOOSE = R++ +src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$' - lines = match[0].match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno += lines.length; - } - this.yylloc = { - first_line: this.yylloc.last_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.last_column, - last_column: lines ? - lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : - this.yylloc.last_column + match[0].length - }; - this.yytext += match[0]; - this.match += match[0]; - this.matches = match; - this.yyleng = this.yytext.length; - if (this.options.ranges) { - this.yylloc.range = [this.offset, this.offset += this.yyleng]; - } - this._more = false; - this._backtrack = false; - this._input = this._input.slice(match[0].length); - this.matched += match[0]; - token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); - if (this.done && this._input) { - this.done = false; - } - if (token) { - return token; - } else if (this._backtrack) { - // recover context - for (var k in backup) { - this[k] = backup[k]; - } - return false; // rule action called reject() implying the next rule should be tested instead. - } - return false; - }, +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +var COERCE = R++ +src[COERCE] = '(?:^|[^\\d])' + + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:$|[^\\d])' -// return next match in input -next:function () { - if (this.done) { - return this.EOF; - } - if (!this._input) { - this.done = true; - } +// Tilde ranges. +// Meaning is "reasonably at or greater than" +var LONETILDE = R++ +src[LONETILDE] = '(?:~>?)' - var token, - match, - tempMatch, - index; - if (!this._more) { - this.yytext = ''; - this.match = ''; - } - var rules = this._currentRules(); - for (var i = 0; i < rules.length; i++) { - tempMatch = this._input.match(this.rules[rules[i]]); - if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { - match = tempMatch; - index = i; - if (this.options.backtrack_lexer) { - token = this.test_match(tempMatch, rules[i]); - if (token !== false) { - return token; - } else if (this._backtrack) { - match = false; - continue; // rule action called reject() implying a rule MISmatch. - } else { - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - } else if (!this.options.flex) { - break; - } - } - } - if (match) { - token = this.test_match(match, rules[index]); - if (token !== false) { - return token; - } - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - if (this._input === "") { - return this.EOF; - } else { - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { - text: "", - token: null, - line: this.yylineno - }); - } - }, +var TILDETRIM = R++ +src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+' +re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g') +var tildeTrimReplace = '$1~' -// return next match that has a token -lex:function lex() { - var r = this.next(); - if (r) { - return r; - } else { - return this.lex(); - } - }, +var TILDE = R++ +src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$' +var TILDELOOSE = R++ +src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$' -// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) -begin:function begin(condition) { - this.conditionStack.push(condition); - }, +// Caret ranges. +// Meaning is "at least and backwards compatible with" +var LONECARET = R++ +src[LONECARET] = '(?:\\^)' -// pop the previously active lexer condition state off the condition stack -popState:function popState() { - var n = this.conditionStack.length - 1; - if (n > 0) { - return this.conditionStack.pop(); - } else { - return this.conditionStack[0]; - } - }, +var CARETTRIM = R++ +src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+' +re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g') +var caretTrimReplace = '$1^' -// produce the lexer rule set which is active for the currently active lexer condition state -_currentRules:function _currentRules() { - if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { - return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; - } else { - return this.conditions["INITIAL"].rules; - } - }, +var CARET = R++ +src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$' +var CARETLOOSE = R++ +src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$' -// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available -topState:function topState(n) { - n = this.conditionStack.length - 1 - Math.abs(n || 0); - if (n >= 0) { - return this.conditionStack[n]; - } else { - return "INITIAL"; +// A simple gt/lt/eq thing, or just "" to indicate "any version" +var COMPARATORLOOSE = R++ +src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$' +var COMPARATOR = R++ +src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$' + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +var COMPARATORTRIM = R++ +src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + + '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')' + +// this one has to use the /g flag +re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g') +var comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +var HYPHENRANGE = R++ +src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAIN] + ')' + + '\\s*$' + +var HYPHENRANGELOOSE = R++ +src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s*$' + +// Star ranges basically just allow anything at all. +var STAR = R++ +src[STAR] = '(<|>)?=?\\s*\\*' + +// Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. +for (var i = 0; i < R; i++) { + debug(i, src[i]) + if (!re[i]) { + re[i] = new RegExp(src[i]) + } +} + +exports.parse = parse +function parse (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + if (version.length > MAX_LENGTH) { + return null + } + + var r = options.loose ? re[LOOSE] : re[FULL] + if (!r.test(version)) { + return null + } + + try { + return new SemVer(version, options) + } catch (er) { + return null + } +} + +exports.valid = valid +function valid (version, options) { + var v = parse(version, options) + return v ? v.version : null +} + +exports.clean = clean +function clean (version, options) { + var s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} + +exports.SemVer = SemVer + +function SemVer (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + if (version instanceof SemVer) { + if (version.loose === options.loose) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError('Invalid Version: ' + version) + } + + if (version.length > MAX_LENGTH) { + throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') + } + + if (!(this instanceof SemVer)) { + return new SemVer(version, options) + } + + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + + var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]) + + if (!m) { + throw new TypeError('Invalid Version: ' + version) + } + + this.raw = version + + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map(function (id) { + if (/^[0-9]+$/.test(id)) { + var num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num } - }, + } + return id + }) + } -// alias for begin(condition) -pushState:function pushState(condition) { - this.begin(condition); - }, + this.build = m[5] ? m[5].split('.') : [] + this.format() +} -// return the number of states currently on the stack -stateStackSize:function stateStackSize() { - return this.conditionStack.length; - }, -options: {}, -performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { -var YYSTATE=YY_START; -switch($avoiding_name_collisions) { -case 0:return 5 -break; -case 1:/* skip whitespace */ -break; -case 2:return 8 -break; -case 3:return 16 -break; -case 4:return 17 -break; -case 5:return 11 -break; -case 6:return 10 -break; -case 7:return 9 -break; -case 8:return 14 -break; -case 9:return 15 -break; -case 10:return 12 -break; -case 11:return 7 -break; -case 12:return 7 -break; -case 13:return 7 -break; -case 14:return 7 -break; -case 15:return 7 -break; -case 16:return 7 -break; -case 17:return 7 -break; -case 18:return 7 -break; -case 19:return 7 -break; -case 20:return 7 -break; -case 21:return 7 -break; -case 22:return 7 -break; -case 23:return 7 -break; -case 24:return 13 -break; -case 25:return 13 -break; -case 26:return 13 -break; -case 27:return 13 -break; -case 28:return 13 -break; -case 29:return 13 -break; -case 30:return 13 -break; -case 31:return 13 -break; -case 32:return 7 -break; -case 33:return 13 -break; -case 34:return 7 -break; -case 35:return 13 -break; -case 36:return 7 -break; -case 37:return 13 -break; -case 38:return 13 -break; +SemVer.prototype.format = function () { + this.version = this.major + '.' + this.minor + '.' + this.patch + if (this.prerelease.length) { + this.version += '-' + this.prerelease.join('.') + } + return this.version +} + +SemVer.prototype.toString = function () { + return this.version +} + +SemVer.prototype.compare = function (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return this.compareMain(other) || this.comparePre(other) +} + +SemVer.prototype.compareMain = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) +} + +SemVer.prototype.comparePre = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + var i = 0 + do { + var a = this.prerelease[i] + var b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) +} + +// preminor will bump the version up to the next minor release, and immediately +// down to pre-release. premajor and prepatch work the same way. +SemVer.prototype.inc = function (release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier) + this.inc('pre', identifier) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier) + } + this.inc('pre', identifier) + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0] + } else { + var i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + this.prerelease.push(0) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0] + } + } else { + this.prerelease = [identifier, 0] + } + } + break + + default: + throw new Error('invalid increment argument: ' + release) + } + this.format() + this.raw = this.version + return this +} + +exports.inc = inc +function inc (version, release, loose, identifier) { + if (typeof (loose) === 'string') { + identifier = loose + loose = undefined + } + + try { + return new SemVer(version, loose).inc(release, identifier).version + } catch (er) { + return null + } +} + +exports.diff = diff +function diff (version1, version2) { + if (eq(version1, version2)) { + return null + } else { + var v1 = parse(version1) + var v2 = parse(version2) + var prefix = '' + if (v1.prerelease.length || v2.prerelease.length) { + prefix = 'pre' + var defaultResult = 'prerelease' + } + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key + } + } + } + return defaultResult // may be undefined + } +} + +exports.compareIdentifiers = compareIdentifiers + +var numeric = /^[0-9]+$/ +function compareIdentifiers (a, b) { + var anum = numeric.test(a) + var bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +exports.rcompareIdentifiers = rcompareIdentifiers +function rcompareIdentifiers (a, b) { + return compareIdentifiers(b, a) +} + +exports.major = major +function major (a, loose) { + return new SemVer(a, loose).major +} + +exports.minor = minor +function minor (a, loose) { + return new SemVer(a, loose).minor +} + +exports.patch = patch +function patch (a, loose) { + return new SemVer(a, loose).patch +} + +exports.compare = compare +function compare (a, b, loose) { + return new SemVer(a, loose).compare(new SemVer(b, loose)) +} + +exports.compareLoose = compareLoose +function compareLoose (a, b) { + return compare(a, b, true) +} + +exports.rcompare = rcompare +function rcompare (a, b, loose) { + return compare(b, a, loose) +} + +exports.sort = sort +function sort (list, loose) { + return list.sort(function (a, b) { + return exports.compare(a, b, loose) + }) +} + +exports.rsort = rsort +function rsort (list, loose) { + return list.sort(function (a, b) { + return exports.rcompare(a, b, loose) + }) +} + +exports.gt = gt +function gt (a, b, loose) { + return compare(a, b, loose) > 0 +} + +exports.lt = lt +function lt (a, b, loose) { + return compare(a, b, loose) < 0 +} + +exports.eq = eq +function eq (a, b, loose) { + return compare(a, b, loose) === 0 +} + +exports.neq = neq +function neq (a, b, loose) { + return compare(a, b, loose) !== 0 +} + +exports.gte = gte +function gte (a, b, loose) { + return compare(a, b, loose) >= 0 +} + +exports.lte = lte +function lte (a, b, loose) { + return compare(a, b, loose) <= 0 +} + +exports.cmp = cmp +function cmp (a, op, b, loose) { + switch (op) { + case '===': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a === b + + case '!==': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError('Invalid operator: ' + op) + } +} + +exports.Comparator = Comparator +function Comparator (comp, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } + + if (!(this instanceof Comparator)) { + return new Comparator(comp, options) + } + + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } + + debug('comp', this) +} + +var ANY = {} +Comparator.prototype.parse = function (comp) { + var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR] + var m = comp.match(r) + + if (!m) { + throw new TypeError('Invalid comparator: ' + comp) + } + + this.operator = m[1] + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } +} + +Comparator.prototype.toString = function () { + return this.value +} + +Comparator.prototype.test = function (version) { + debug('Comparator.test', version, this.options.loose) + + if (this.semver === ANY) { + return true + } + + if (typeof version === 'string') { + version = new SemVer(version, this.options) + } + + return cmp(version, this.operator, this.semver, this.options) +} + +Comparator.prototype.intersects = function (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + var rangeTmp + + if (this.operator === '') { + rangeTmp = new Range(comp.value, options) + return satisfies(this.value, rangeTmp, options) + } else if (comp.operator === '') { + rangeTmp = new Range(this.value, options) + return satisfies(comp.semver, rangeTmp, options) + } + + var sameDirectionIncreasing = + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '>=' || comp.operator === '>') + var sameDirectionDecreasing = + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '<=' || comp.operator === '<') + var sameSemVer = this.semver.version === comp.semver.version + var differentDirectionsInclusive = + (this.operator === '>=' || this.operator === '<=') && + (comp.operator === '>=' || comp.operator === '<=') + var oppositeDirectionsLessThan = + cmp(this.semver, '<', comp.semver, options) && + ((this.operator === '>=' || this.operator === '>') && + (comp.operator === '<=' || comp.operator === '<')) + var oppositeDirectionsGreaterThan = + cmp(this.semver, '>', comp.semver, options) && + ((this.operator === '<=' || this.operator === '<') && + (comp.operator === '>=' || comp.operator === '>')) + + return sameDirectionIncreasing || sameDirectionDecreasing || + (sameSemVer && differentDirectionsInclusive) || + oppositeDirectionsLessThan || oppositeDirectionsGreaterThan +} + +exports.Range = Range +function Range (range, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (range instanceof Range) { + if (range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease) { + return range + } else { + return new Range(range.raw, options) + } + } + + if (range instanceof Comparator) { + return new Range(range.value, options) + } + + if (!(this instanceof Range)) { + return new Range(range, options) + } + + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease + + // First, split based on boolean or || + this.raw = range + this.set = range.split(/\s*\|\|\s*/).map(function (range) { + return this.parseRange(range.trim()) + }, this).filter(function (c) { + // throw out any that are not relevant for whatever reason + return c.length + }) + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + range) + } + + this.format() +} + +Range.prototype.format = function () { + this.range = this.set.map(function (comps) { + return comps.join(' ').trim() + }).join('||').trim() + return this.range +} + +Range.prototype.toString = function () { + return this.range +} + +Range.prototype.parseRange = function (range) { + var loose = this.options.loose + range = range.trim() + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE] + range = range.replace(hr, hyphenReplace) + debug('hyphen replace', range) + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, re[COMPARATORTRIM]) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[TILDETRIM], tildeTrimReplace) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[CARETTRIM], caretTrimReplace) + + // normalize spaces + range = range.split(/\s+/).join(' ') + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR] + var set = range.split(' ').map(function (comp) { + return parseComparator(comp, this.options) + }, this).join(' ').split(/\s+/) + if (this.options.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function (comp) { + return !!comp.match(compRe) + }) + } + set = set.map(function (comp) { + return new Comparator(comp, this.options) + }, this) + + return set +} + +Range.prototype.intersects = function (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some(function (thisComparators) { + return thisComparators.every(function (thisComparator) { + return range.set.some(function (rangeComparators) { + return rangeComparators.every(function (rangeComparator) { + return thisComparator.intersects(rangeComparator, options) + }) + }) + }) + }) +} + +// Mostly just for testing and legacy API reasons +exports.toComparators = toComparators +function toComparators (range, options) { + return new Range(range, options).set.map(function (comp) { + return comp.map(function (c) { + return c.value + }).join(' ').trim().split(' ') + }) +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +function parseComparator (comp, options) { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +function isX (id) { + return !id || id.toLowerCase() === 'x' || id === '*' +} + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceTildes (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceTilde(comp, options) + }).join(' ') +} + +function replaceTilde (comp, options) { + var r = options.loose ? re[TILDELOOSE] : re[TILDE] + return comp.replace(r, function (_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0 + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else if (pr) { + debug('replaceTilde pr', pr) + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } else { + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +function replaceCarets (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceCaret(comp, options) + }).join(' ') +} + +function replaceCaret (comp, options) { + debug('caret', comp, options) + var r = options.loose ? re[CARETLOOSE] : re[CARET] + return comp.replace(r, function (_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + if (M === '0') { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else { + ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0' + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + (+M + 1) + '.0.0' + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + (+M + 1) + '.0.0' + } + } + + debug('caret return', ret) + return ret + }) +} + +function replaceXRanges (comp, options) { + debug('replaceXRanges', comp, options) + return comp.split(/\s+/).map(function (comp) { + return replaceXRange(comp, options) + }).join(' ') +} + +function replaceXRange (comp, options) { + comp = comp.trim() + var r = options.loose ? re[XRANGELOOSE] : re[XRANGE] + return comp.replace(r, function (ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + var xM = isX(M) + var xm = xM || isX(m) + var xp = xm || isX(p) + var anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + // >1.2.3 => >= 1.2.4 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + ret = gtlt + M + '.' + m + '.' + p + } else if (xm) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (xp) { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +function replaceStars (comp, options) { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(re[STAR], '') +} + +// This function is passed to string.replace(re[HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0 +function hyphenReplace ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = '>=' + fM + '.0.0' + } else if (isX(fp)) { + from = '>=' + fM + '.' + fm + '.0' + } else { + from = '>=' + from + } + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = '<' + (+tM + 1) + '.0.0' + } else if (isX(tp)) { + to = '<' + tM + '.' + (+tm + 1) + '.0' + } else if (tpr) { + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr + } else { + to = '<=' + to + } + + return (from + ' ' + to).trim() +} + +// if ANY of the sets match ALL of its comparators, then pass +Range.prototype.test = function (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + version = new SemVer(version, this.options) + } + + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false +} + +function testSet (set, version, options) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + var allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +} + +exports.satisfies = satisfies +function satisfies (version, range, options) { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} + +exports.maxSatisfying = maxSatisfying +function maxSatisfying (versions, range, options) { + var max = null + var maxSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max +} + +exports.minSatisfying = minSatisfying +function minSatisfying (versions, range, options) { + var min = null + var minSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) + } + } + }) + return min +} + +exports.minVersion = minVersion +function minVersion (range, loose) { + range = new Range(range, loose) + + var minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + comparators.forEach(function (comparator) { + // Clone to avoid manipulating the comparator's semver object. + var compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!minver || gt(minver, compver)) { + minver = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error('Unexpected operation: ' + comparator.operator) + } + }) + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} + +exports.validRange = validRange +function validRange (range, options) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} + +// Determine if version is less than all the versions possible in the range +exports.ltr = ltr +function ltr (version, range, options) { + return outside(version, range, '<', options) +} + +// Determine if version is greater than all the versions possible in the range. +exports.gtr = gtr +function gtr (version, range, options) { + return outside(version, range, '>', options) +} + +exports.outside = outside +function outside (version, range, hilo, options) { + version = new SemVer(version, options) + range = new Range(range, options) + + var gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + var high = null + var low = null + + comparators.forEach(function (comparator) { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +exports.prerelease = prerelease +function prerelease (version, options) { + var parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +} + +exports.intersects = intersects +function intersects (r1, r2, options) { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2) +} + +exports.coerce = coerce +function coerce (version) { + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + var match = version.match(re[COERCE]) + + if (match == null) { + return null + } + + return parse(match[1] + + '.' + (match[2] || '0') + + '.' + (match[3] || '0')) +} + + +/***/ }), +/* 190 */ +/***/ (function(module, exports, __webpack_require__) { + +var parse = __webpack_require__(191); +var correct = __webpack_require__(193); + +var genericWarning = ( + 'license should be ' + + 'a valid SPDX license expression (without "LicenseRef"), ' + + '"UNLICENSED", or ' + + '"SEE LICENSE IN "' +); + +var fileReferenceRE = /^SEE LICEN[CS]E IN (.+)$/; + +function startsWith(prefix, string) { + return string.slice(0, prefix.length) === prefix; +} + +function usesLicenseRef(ast) { + if (ast.hasOwnProperty('license')) { + var license = ast.license; + return ( + startsWith('LicenseRef', license) || + startsWith('DocumentRef', license) + ); + } else { + return ( + usesLicenseRef(ast.left) || + usesLicenseRef(ast.right) + ); + } +} + +module.exports = function(argument) { + var ast; + + try { + ast = parse(argument); + } catch (e) { + var match + if ( + argument === 'UNLICENSED' || + argument === 'UNLICENCED' + ) { + return { + validForOldPackages: true, + validForNewPackages: true, + unlicensed: true + }; + } else if (match = fileReferenceRE.exec(argument)) { + return { + validForOldPackages: true, + validForNewPackages: true, + inFile: match[1] + }; + } else { + var result = { + validForOldPackages: false, + validForNewPackages: false, + warnings: [genericWarning] + }; + var corrected = correct(argument); + if (corrected) { + result.warnings.push( + 'license is similar to the valid expression "' + corrected + '"' + ); + } + return result; + } + } + + if (usesLicenseRef(ast)) { + return { + validForNewPackages: false, + validForOldPackages: false, + spdx: true, + warnings: [genericWarning] + }; + } else { + return { + validForNewPackages: true, + validForOldPackages: true, + spdx: true + }; + } +}; + + +/***/ }), +/* 191 */ +/***/ (function(module, exports, __webpack_require__) { + +var parser = __webpack_require__(192).parser + +module.exports = function (argument) { + return parser.parse(argument) +} + + +/***/ }), +/* 192 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(module) {/* parser generated by jison 0.4.17 */ +/* + Returns a Parser object of the following structure: + + Parser: { + yy: {} + } + + Parser.prototype: { + yy: {}, + trace: function(), + symbols_: {associative list: name ==> number}, + terminals_: {associative list: number ==> name}, + productions_: [...], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), + table: [...], + defaultActions: {...}, + parseError: function(str, hash), + parse: function(input), + + lexer: { + EOF: 1, + parseError: function(str, hash), + setInput: function(input), + input: function(), + unput: function(str), + more: function(), + less: function(n), + pastInput: function(), + upcomingInput: function(), + showPosition: function(), + test_match: function(regex_match_array, rule_index), + next: function(), + lex: function(), + begin: function(condition), + popState: function(), + _currentRules: function(), + topState: function(), + pushState: function(condition), + + options: { + ranges: boolean (optional: true ==> token location info will include a .range[] member) + flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) + backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) + }, + + performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), + rules: [...], + conditions: {associative list: name ==> set}, + } + } + + + token location info (@$, _$, etc.): { + first_line: n, + last_line: n, + first_column: n, + last_column: n, + range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) + } + + + the parseError function receives a 'hash' object with these members for lexer and parser errors: { + text: (matched text) + token: (the produced terminal token, if any) + line: (yylineno) + } + while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { + loc: (yylloc) + expected: (string describing the set of expected tokens) + recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) + } +*/ +var spdxparse = (function(){ +var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,5],$V1=[1,6],$V2=[1,7],$V3=[1,4],$V4=[1,9],$V5=[1,10],$V6=[5,14,15,17],$V7=[5,12,14,15,17]; +var parser = {trace: function trace() { }, +yy: {}, +symbols_: {"error":2,"start":3,"expression":4,"EOS":5,"simpleExpression":6,"LICENSE":7,"PLUS":8,"LICENSEREF":9,"DOCUMENTREF":10,"COLON":11,"WITH":12,"EXCEPTION":13,"AND":14,"OR":15,"OPEN":16,"CLOSE":17,"$accept":0,"$end":1}, +terminals_: {2:"error",5:"EOS",7:"LICENSE",8:"PLUS",9:"LICENSEREF",10:"DOCUMENTREF",11:"COLON",12:"WITH",13:"EXCEPTION",14:"AND",15:"OR",16:"OPEN",17:"CLOSE"}, +productions_: [0,[3,2],[6,1],[6,2],[6,1],[6,3],[4,1],[4,3],[4,3],[4,3],[4,3]], +performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { +/* this == yyval */ + +var $0 = $$.length - 1; +switch (yystate) { +case 1: +return this.$ = $$[$0-1] +break; +case 2: case 4: case 5: +this.$ = {license: yytext} +break; +case 3: +this.$ = {license: $$[$0-1], plus: true} +break; +case 6: +this.$ = $$[$0] +break; +case 7: +this.$ = {exception: $$[$0]} +this.$.license = $$[$0-2].license +if ($$[$0-2].hasOwnProperty('plus')) { + this.$.plus = $$[$0-2].plus +} +break; +case 8: +this.$ = {conjunction: 'and', left: $$[$0-2], right: $$[$0]} +break; +case 9: +this.$ = {conjunction: 'or', left: $$[$0-2], right: $$[$0]} +break; +case 10: +this.$ = $$[$0-1] +break; +} +}, +table: [{3:1,4:2,6:3,7:$V0,9:$V1,10:$V2,16:$V3},{1:[3]},{5:[1,8],14:$V4,15:$V5},o($V6,[2,6],{12:[1,11]}),{4:12,6:3,7:$V0,9:$V1,10:$V2,16:$V3},o($V7,[2,2],{8:[1,13]}),o($V7,[2,4]),{11:[1,14]},{1:[2,1]},{4:15,6:3,7:$V0,9:$V1,10:$V2,16:$V3},{4:16,6:3,7:$V0,9:$V1,10:$V2,16:$V3},{13:[1,17]},{14:$V4,15:$V5,17:[1,18]},o($V7,[2,3]),{9:[1,19]},o($V6,[2,8]),o([5,15,17],[2,9],{14:$V4}),o($V6,[2,7]),o($V6,[2,10]),o($V7,[2,5])], +defaultActions: {8:[2,1]}, +parseError: function parseError(str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + function _parseError (msg, hash) { + this.message = msg; + this.hash = hash; + } + _parseError.prototype = Error; + + throw new _parseError(str, hash); + } +}, +parse: function parse(input) { + var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; + var args = lstack.slice.call(arguments, 1); + var lexer = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k)) { + sharedState.yy[k] = this.yy[k]; + } + } + lexer.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer; + sharedState.yy.parser = this; + if (typeof lexer.yylloc == 'undefined') { + lexer.yylloc = {}; + } + var yyloc = lexer.yylloc; + lstack.push(yyloc); + var ranges = lexer.options && lexer.options.ranges; + if (typeof sharedState.yy.parseError === 'function') { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + _token_stack: + var lex = function () { + var token; + token = lexer.lex() || EOF; + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + return token; + }; + var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == 'undefined') { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === 'undefined' || !action.length || !action[0]) { + var errStr = ''; + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push('\'' + this.terminals_[p] + '\''); + } + } + if (lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; + } else { + errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); + } + this.parseError(errStr, { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer.yytext); + lstack.push(lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer.yyleng; + yytext = lexer.yytext; + yylineno = lexer.yylineno; + yyloc = lexer.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r !== 'undefined') { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; +}}; +/* generated by jison-lex 0.3.4 */ +var lexer = (function(){ +var lexer = ({ + +EOF:1, + +parseError:function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, + +// resets the lexer, sets new input +setInput:function (input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0,0]; + } + this.offset = 0; + return this; + }, + +// consumes and returns one char from the input +input:function () { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + + this._input = this._input.slice(1); + return ch; + }, + +// unshifts one char (or a string) into the input +unput:function (ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r = this.yylloc.range; + + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? + (lines.length === oldLines.length ? this.yylloc.first_column : 0) + + oldLines[oldLines.length - lines.length].length - lines[0].length : + this.yylloc.first_column - len + }; + + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, + +// When called from action, caches matched text and appends it on next action +more:function () { + this._more = true; + return this; + }, + +// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. +reject:function () { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + + } + return this; + }, + +// retain first n characters of the match +less:function (n) { + this.unput(this.match.slice(n)); + }, + +// displays already matched input, i.e. for error messages +pastInput:function () { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); + }, + +// displays upcoming input, i.e. for error messages +upcomingInput:function () { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20-next.length); + } + return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); + }, + +// displays the character position where the lexing error occurred, i.e. for error messages +showPosition:function () { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c + "^"; + }, + +// test the lexed token: return FALSE when not a match, otherwise return token +test_match:function (match, indexed_rule) { + var token, + lines, + backup; + + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? + lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : + this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token) { + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; + } + return false; // rule action called reject() implying the next rule should be tested instead. + } + return false; + }, + +// return next match in input +next:function () { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + + var token, + match, + tempMatch, + index; + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rules[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = false; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match) { + token = this.test_match(match, rules[index]); + if (token !== false) { + return token; + } + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, + +// return next match that has a token +lex:function lex() { + var r = this.next(); + if (r) { + return r; + } else { + return this.lex(); + } + }, + +// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) +begin:function begin(condition) { + this.conditionStack.push(condition); + }, + +// pop the previously active lexer condition state off the condition stack +popState:function popState() { + var n = this.conditionStack.length - 1; + if (n > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + +// produce the lexer rule set which is active for the currently active lexer condition state +_currentRules:function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, + +// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available +topState:function topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return "INITIAL"; + } + }, + +// alias for begin(condition) +pushState:function pushState(condition) { + this.begin(condition); + }, + +// return the number of states currently on the stack +stateStackSize:function stateStackSize() { + return this.conditionStack.length; + }, +options: {}, +performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { +var YYSTATE=YY_START; +switch($avoiding_name_collisions) { +case 0:return 5 +break; +case 1:/* skip whitespace */ +break; +case 2:return 8 +break; +case 3:return 16 +break; +case 4:return 17 +break; +case 5:return 11 +break; +case 6:return 10 +break; +case 7:return 9 +break; +case 8:return 14 +break; +case 9:return 15 +break; +case 10:return 12 +break; +case 11:return 7 +break; +case 12:return 7 +break; +case 13:return 7 +break; +case 14:return 7 +break; +case 15:return 7 +break; +case 16:return 7 +break; +case 17:return 7 +break; +case 18:return 7 +break; +case 19:return 7 +break; +case 20:return 7 +break; +case 21:return 7 +break; +case 22:return 7 +break; +case 23:return 7 +break; +case 24:return 13 +break; +case 25:return 13 +break; +case 26:return 13 +break; +case 27:return 13 +break; +case 28:return 13 +break; +case 29:return 13 +break; +case 30:return 13 +break; +case 31:return 13 +break; +case 32:return 7 +break; +case 33:return 13 +break; +case 34:return 7 +break; +case 35:return 13 +break; +case 36:return 7 +break; +case 37:return 13 +break; +case 38:return 13 +break; case 39:return 7 break; case 40:return 13 @@ -19627,4372 +20900,6162 @@ break; case 364:return 7 break; } -}, -rules: [/^(?:$)/,/^(?:\s+)/,/^(?:\+)/,/^(?:\()/,/^(?:\))/,/^(?::)/,/^(?:DocumentRef-([0-9A-Za-z-+.]+))/,/^(?:LicenseRef-([0-9A-Za-z-+.]+))/,/^(?:AND)/,/^(?:OR)/,/^(?:WITH)/,/^(?:BSD-3-Clause-No-Nuclear-License-2014)/,/^(?:BSD-3-Clause-No-Nuclear-Warranty)/,/^(?:GPL-2\.0-with-classpath-exception)/,/^(?:GPL-3\.0-with-autoconf-exception)/,/^(?:GPL-2\.0-with-autoconf-exception)/,/^(?:BSD-3-Clause-No-Nuclear-License)/,/^(?:MPL-2\.0-no-copyleft-exception)/,/^(?:GPL-2\.0-with-bison-exception)/,/^(?:GPL-2\.0-with-font-exception)/,/^(?:GPL-2\.0-with-GCC-exception)/,/^(?:CNRI-Python-GPL-Compatible)/,/^(?:GPL-3\.0-with-GCC-exception)/,/^(?:BSD-3-Clause-Attribution)/,/^(?:Classpath-exception-2\.0)/,/^(?:WxWindows-exception-3\.1)/,/^(?:freertos-exception-2\.0)/,/^(?:Autoconf-exception-3\.0)/,/^(?:i2p-gpl-java-exception)/,/^(?:gnu-javamail-exception)/,/^(?:Nokia-Qt-exception-1\.1)/,/^(?:Autoconf-exception-2\.0)/,/^(?:BSD-2-Clause-FreeBSD)/,/^(?:u-boot-exception-2\.0)/,/^(?:zlib-acknowledgement)/,/^(?:Bison-exception-2\.2)/,/^(?:BSD-2-Clause-NetBSD)/,/^(?:CLISP-exception-2\.0)/,/^(?:eCos-exception-2\.0)/,/^(?:BSD-3-Clause-Clear)/,/^(?:Font-exception-2\.0)/,/^(?:FLTK-exception-2\.0)/,/^(?:GCC-exception-2\.0)/,/^(?:Qwt-exception-1\.0)/,/^(?:Libtool-exception)/,/^(?:BSD-3-Clause-LBNL)/,/^(?:GCC-exception-3\.1)/,/^(?:Artistic-1\.0-Perl)/,/^(?:Artistic-1\.0-cl8)/,/^(?:CC-BY-NC-SA-2\.5)/,/^(?:MIT-advertising)/,/^(?:BSD-Source-Code)/,/^(?:CC-BY-NC-SA-4\.0)/,/^(?:LiLiQ-Rplus-1\.1)/,/^(?:CC-BY-NC-SA-3\.0)/,/^(?:BSD-4-Clause-UC)/,/^(?:CC-BY-NC-SA-2\.0)/,/^(?:CC-BY-NC-SA-1\.0)/,/^(?:CC-BY-NC-ND-4\.0)/,/^(?:CC-BY-NC-ND-3\.0)/,/^(?:CC-BY-NC-ND-2\.5)/,/^(?:CC-BY-NC-ND-2\.0)/,/^(?:CC-BY-NC-ND-1\.0)/,/^(?:LZMA-exception)/,/^(?:BitTorrent-1\.1)/,/^(?:CrystalStacker)/,/^(?:FLTK-exception)/,/^(?:SugarCRM-1\.1\.3)/,/^(?:BSD-Protection)/,/^(?:BitTorrent-1\.0)/,/^(?:HaskellReport)/,/^(?:Interbase-1\.0)/,/^(?:StandardML-NJ)/,/^(?:mif-exception)/,/^(?:Frameworx-1\.0)/,/^(?:389-exception)/,/^(?:CC-BY-NC-2\.0)/,/^(?:CC-BY-NC-2\.5)/,/^(?:CC-BY-NC-3\.0)/,/^(?:CC-BY-NC-4\.0)/,/^(?:W3C-19980720)/,/^(?:CC-BY-SA-1\.0)/,/^(?:CC-BY-SA-2\.0)/,/^(?:CC-BY-SA-2\.5)/,/^(?:CC-BY-ND-2\.0)/,/^(?:CC-BY-SA-4\.0)/,/^(?:CC-BY-SA-3\.0)/,/^(?:Artistic-1\.0)/,/^(?:Artistic-2\.0)/,/^(?:CC-BY-ND-2\.5)/,/^(?:CC-BY-ND-3\.0)/,/^(?:CC-BY-ND-4\.0)/,/^(?:CC-BY-ND-1\.0)/,/^(?:BSD-4-Clause)/,/^(?:BSD-3-Clause)/,/^(?:BSD-2-Clause)/,/^(?:CC-BY-NC-1\.0)/,/^(?:bzip2-1\.0\.6)/,/^(?:Unicode-TOU)/,/^(?:CNRI-Jython)/,/^(?:ImageMagick)/,/^(?:Adobe-Glyph)/,/^(?:CUA-OPL-1\.0)/,/^(?:OLDAP-2\.2\.2)/,/^(?:LiLiQ-R-1\.1)/,/^(?:bzip2-1\.0\.5)/,/^(?:LiLiQ-P-1\.1)/,/^(?:OLDAP-2\.0\.1)/,/^(?:OLDAP-2\.2\.1)/,/^(?:CNRI-Python)/,/^(?:XFree86-1\.1)/,/^(?:OSET-PL-2\.1)/,/^(?:Apache-2\.0)/,/^(?:Watcom-1\.0)/,/^(?:PostgreSQL)/,/^(?:Python-2\.0)/,/^(?:RHeCos-1\.1)/,/^(?:EUDatagrid)/,/^(?:Spencer-99)/,/^(?:Intel-ACPI)/,/^(?:CECILL-1\.0)/,/^(?:CECILL-1\.1)/,/^(?:JasPer-2\.0)/,/^(?:CECILL-2\.0)/,/^(?:CECILL-2\.1)/,/^(?:gSOAP-1\.3b)/,/^(?:Spencer-94)/,/^(?:Apache-1\.1)/,/^(?:Spencer-86)/,/^(?:Apache-1\.0)/,/^(?:ClArtistic)/,/^(?:TORQUE-1\.1)/,/^(?:CATOSL-1\.1)/,/^(?:Adobe-2006)/,/^(?:Zimbra-1\.4)/,/^(?:Zimbra-1\.3)/,/^(?:Condor-1\.1)/,/^(?:CC-BY-3\.0)/,/^(?:CC-BY-2\.5)/,/^(?:OLDAP-2\.4)/,/^(?:SGI-B-1\.1)/,/^(?:SISSL-1\.2)/,/^(?:SGI-B-1\.0)/,/^(?:OLDAP-2\.3)/,/^(?:CC-BY-4\.0)/,/^(?:Crossword)/,/^(?:SimPL-2\.0)/,/^(?:OLDAP-2\.2)/,/^(?:OLDAP-2\.1)/,/^(?:ErlPL-1\.1)/,/^(?:LPPL-1\.3a)/,/^(?:LPPL-1\.3c)/,/^(?:OLDAP-2\.0)/,/^(?:Leptonica)/,/^(?:CPOL-1\.02)/,/^(?:OLDAP-1\.4)/,/^(?:OLDAP-1\.3)/,/^(?:CC-BY-2\.0)/,/^(?:Unlicense)/,/^(?:OLDAP-2\.8)/,/^(?:OLDAP-1\.2)/,/^(?:MakeIndex)/,/^(?:OLDAP-2\.7)/,/^(?:OLDAP-1\.1)/,/^(?:Sleepycat)/,/^(?:D-FSL-1\.0)/,/^(?:CC-BY-1\.0)/,/^(?:OLDAP-2\.6)/,/^(?:WXwindows)/,/^(?:NPOSL-3\.0)/,/^(?:FreeImage)/,/^(?:SGI-B-2\.0)/,/^(?:OLDAP-2\.5)/,/^(?:Beerware)/,/^(?:Newsletr)/,/^(?:NBPL-1\.0)/,/^(?:NASA-1\.3)/,/^(?:NLOD-1\.0)/,/^(?:AGPL-1\.0)/,/^(?:OCLC-2\.0)/,/^(?:ODbL-1\.0)/,/^(?:PDDL-1\.0)/,/^(?:Motosoto)/,/^(?:Afmparse)/,/^(?:ANTLR-PD)/,/^(?:LPL-1\.02)/,/^(?:Abstyles)/,/^(?:eCos-2\.0)/,/^(?:APSL-1\.0)/,/^(?:LPPL-1\.2)/,/^(?:LPPL-1\.1)/,/^(?:LPPL-1\.0)/,/^(?:APSL-1\.1)/,/^(?:APSL-2\.0)/,/^(?:Info-ZIP)/,/^(?:Zend-2\.0)/,/^(?:IBM-pibs)/,/^(?:LGPL-2\.0)/,/^(?:LGPL-3\.0)/,/^(?:LGPL-2\.1)/,/^(?:GFDL-1\.3)/,/^(?:PHP-3\.01)/,/^(?:GFDL-1\.2)/,/^(?:GFDL-1\.1)/,/^(?:AGPL-3\.0)/,/^(?:Giftware)/,/^(?:EUPL-1\.1)/,/^(?:RPSL-1\.0)/,/^(?:EUPL-1\.0)/,/^(?:MIT-enna)/,/^(?:CECILL-B)/,/^(?:diffmark)/,/^(?:CECILL-C)/,/^(?:CDDL-1\.0)/,/^(?:Sendmail)/,/^(?:CDDL-1\.1)/,/^(?:CPAL-1\.0)/,/^(?:APSL-1\.2)/,/^(?:NPL-1\.1)/,/^(?:AFL-1\.2)/,/^(?:Caldera)/,/^(?:AFL-2\.0)/,/^(?:FSFULLR)/,/^(?:AFL-2\.1)/,/^(?:VSL-1\.0)/,/^(?:VOSTROM)/,/^(?:UPL-1\.0)/,/^(?:Dotseqn)/,/^(?:CPL-1\.0)/,/^(?:dvipdfm)/,/^(?:EPL-1\.0)/,/^(?:OCCT-PL)/,/^(?:ECL-1\.0)/,/^(?:Latex2e)/,/^(?:ECL-2\.0)/,/^(?:GPL-1\.0)/,/^(?:GPL-2\.0)/,/^(?:GPL-3\.0)/,/^(?:AFL-3\.0)/,/^(?:LAL-1\.2)/,/^(?:LAL-1\.3)/,/^(?:EFL-1\.0)/,/^(?:EFL-2\.0)/,/^(?:gnuplot)/,/^(?:Aladdin)/,/^(?:LPL-1\.0)/,/^(?:libtiff)/,/^(?:Entessa)/,/^(?:AMDPLPA)/,/^(?:IPL-1\.0)/,/^(?:OPL-1\.0)/,/^(?:OSL-1\.0)/,/^(?:OSL-1\.1)/,/^(?:OSL-2\.0)/,/^(?:OSL-2\.1)/,/^(?:OSL-3\.0)/,/^(?:OpenSSL)/,/^(?:ZPL-2\.1)/,/^(?:PHP-3\.0)/,/^(?:ZPL-2\.0)/,/^(?:ZPL-1\.1)/,/^(?:CC0-1\.0)/,/^(?:SPL-1\.0)/,/^(?:psutils)/,/^(?:MPL-1\.0)/,/^(?:QPL-1\.0)/,/^(?:MPL-1\.1)/,/^(?:MPL-2\.0)/,/^(?:APL-1\.0)/,/^(?:RPL-1\.1)/,/^(?:RPL-1\.5)/,/^(?:MIT-CMU)/,/^(?:Multics)/,/^(?:Eurosym)/,/^(?:BSL-1\.0)/,/^(?:MIT-feh)/,/^(?:Saxpath)/,/^(?:Borceux)/,/^(?:OFL-1\.1)/,/^(?:OFL-1\.0)/,/^(?:AFL-1\.1)/,/^(?:YPL-1\.1)/,/^(?:YPL-1\.0)/,/^(?:NPL-1\.0)/,/^(?:iMatix)/,/^(?:mpich2)/,/^(?:APAFML)/,/^(?:Bahyph)/,/^(?:RSA-MD)/,/^(?:psfrag)/,/^(?:Plexus)/,/^(?:eGenix)/,/^(?:Glulxe)/,/^(?:SAX-PD)/,/^(?:Imlib2)/,/^(?:Wsuipa)/,/^(?:LGPLLR)/,/^(?:Libpng)/,/^(?:xinetd)/,/^(?:MITNFA)/,/^(?:NetCDF)/,/^(?:Naumen)/,/^(?:SMPPL)/,/^(?:Nunit)/,/^(?:FSFUL)/,/^(?:GL2PS)/,/^(?:SMLNJ)/,/^(?:Rdisc)/,/^(?:Noweb)/,/^(?:Nokia)/,/^(?:SISSL)/,/^(?:Qhull)/,/^(?:Intel)/,/^(?:Glide)/,/^(?:Xerox)/,/^(?:AMPAS)/,/^(?:WTFPL)/,/^(?:MS-PL)/,/^(?:XSkat)/,/^(?:MS-RL)/,/^(?:MirOS)/,/^(?:RSCPL)/,/^(?:TMate)/,/^(?:OGTSL)/,/^(?:FSFAP)/,/^(?:NCSA)/,/^(?:Zlib)/,/^(?:SCEA)/,/^(?:SNIA)/,/^(?:NGPL)/,/^(?:NOSL)/,/^(?:ADSL)/,/^(?:MTLL)/,/^(?:NLPL)/,/^(?:Ruby)/,/^(?:JSON)/,/^(?:Barr)/,/^(?:0BSD)/,/^(?:Xnet)/,/^(?:Cube)/,/^(?:curl)/,/^(?:DSDP)/,/^(?:Fair)/,/^(?:HPND)/,/^(?:TOSL)/,/^(?:IJG)/,/^(?:SWL)/,/^(?:Vim)/,/^(?:FTL)/,/^(?:ICU)/,/^(?:OML)/,/^(?:NRL)/,/^(?:DOC)/,/^(?:TCL)/,/^(?:W3C)/,/^(?:NTP)/,/^(?:IPA)/,/^(?:ISC)/,/^(?:X11)/,/^(?:AAL)/,/^(?:AML)/,/^(?:xpp)/,/^(?:Zed)/,/^(?:MIT)/,/^(?:Mup)/], -conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364],"inclusive":true}} -}); -return lexer; -})(); -parser.lexer = lexer; -function Parser () { - this.yy = {}; +}, +rules: [/^(?:$)/,/^(?:\s+)/,/^(?:\+)/,/^(?:\()/,/^(?:\))/,/^(?::)/,/^(?:DocumentRef-([0-9A-Za-z-+.]+))/,/^(?:LicenseRef-([0-9A-Za-z-+.]+))/,/^(?:AND)/,/^(?:OR)/,/^(?:WITH)/,/^(?:BSD-3-Clause-No-Nuclear-License-2014)/,/^(?:BSD-3-Clause-No-Nuclear-Warranty)/,/^(?:GPL-2\.0-with-classpath-exception)/,/^(?:GPL-3\.0-with-autoconf-exception)/,/^(?:GPL-2\.0-with-autoconf-exception)/,/^(?:BSD-3-Clause-No-Nuclear-License)/,/^(?:MPL-2\.0-no-copyleft-exception)/,/^(?:GPL-2\.0-with-bison-exception)/,/^(?:GPL-2\.0-with-font-exception)/,/^(?:GPL-2\.0-with-GCC-exception)/,/^(?:CNRI-Python-GPL-Compatible)/,/^(?:GPL-3\.0-with-GCC-exception)/,/^(?:BSD-3-Clause-Attribution)/,/^(?:Classpath-exception-2\.0)/,/^(?:WxWindows-exception-3\.1)/,/^(?:freertos-exception-2\.0)/,/^(?:Autoconf-exception-3\.0)/,/^(?:i2p-gpl-java-exception)/,/^(?:gnu-javamail-exception)/,/^(?:Nokia-Qt-exception-1\.1)/,/^(?:Autoconf-exception-2\.0)/,/^(?:BSD-2-Clause-FreeBSD)/,/^(?:u-boot-exception-2\.0)/,/^(?:zlib-acknowledgement)/,/^(?:Bison-exception-2\.2)/,/^(?:BSD-2-Clause-NetBSD)/,/^(?:CLISP-exception-2\.0)/,/^(?:eCos-exception-2\.0)/,/^(?:BSD-3-Clause-Clear)/,/^(?:Font-exception-2\.0)/,/^(?:FLTK-exception-2\.0)/,/^(?:GCC-exception-2\.0)/,/^(?:Qwt-exception-1\.0)/,/^(?:Libtool-exception)/,/^(?:BSD-3-Clause-LBNL)/,/^(?:GCC-exception-3\.1)/,/^(?:Artistic-1\.0-Perl)/,/^(?:Artistic-1\.0-cl8)/,/^(?:CC-BY-NC-SA-2\.5)/,/^(?:MIT-advertising)/,/^(?:BSD-Source-Code)/,/^(?:CC-BY-NC-SA-4\.0)/,/^(?:LiLiQ-Rplus-1\.1)/,/^(?:CC-BY-NC-SA-3\.0)/,/^(?:BSD-4-Clause-UC)/,/^(?:CC-BY-NC-SA-2\.0)/,/^(?:CC-BY-NC-SA-1\.0)/,/^(?:CC-BY-NC-ND-4\.0)/,/^(?:CC-BY-NC-ND-3\.0)/,/^(?:CC-BY-NC-ND-2\.5)/,/^(?:CC-BY-NC-ND-2\.0)/,/^(?:CC-BY-NC-ND-1\.0)/,/^(?:LZMA-exception)/,/^(?:BitTorrent-1\.1)/,/^(?:CrystalStacker)/,/^(?:FLTK-exception)/,/^(?:SugarCRM-1\.1\.3)/,/^(?:BSD-Protection)/,/^(?:BitTorrent-1\.0)/,/^(?:HaskellReport)/,/^(?:Interbase-1\.0)/,/^(?:StandardML-NJ)/,/^(?:mif-exception)/,/^(?:Frameworx-1\.0)/,/^(?:389-exception)/,/^(?:CC-BY-NC-2\.0)/,/^(?:CC-BY-NC-2\.5)/,/^(?:CC-BY-NC-3\.0)/,/^(?:CC-BY-NC-4\.0)/,/^(?:W3C-19980720)/,/^(?:CC-BY-SA-1\.0)/,/^(?:CC-BY-SA-2\.0)/,/^(?:CC-BY-SA-2\.5)/,/^(?:CC-BY-ND-2\.0)/,/^(?:CC-BY-SA-4\.0)/,/^(?:CC-BY-SA-3\.0)/,/^(?:Artistic-1\.0)/,/^(?:Artistic-2\.0)/,/^(?:CC-BY-ND-2\.5)/,/^(?:CC-BY-ND-3\.0)/,/^(?:CC-BY-ND-4\.0)/,/^(?:CC-BY-ND-1\.0)/,/^(?:BSD-4-Clause)/,/^(?:BSD-3-Clause)/,/^(?:BSD-2-Clause)/,/^(?:CC-BY-NC-1\.0)/,/^(?:bzip2-1\.0\.6)/,/^(?:Unicode-TOU)/,/^(?:CNRI-Jython)/,/^(?:ImageMagick)/,/^(?:Adobe-Glyph)/,/^(?:CUA-OPL-1\.0)/,/^(?:OLDAP-2\.2\.2)/,/^(?:LiLiQ-R-1\.1)/,/^(?:bzip2-1\.0\.5)/,/^(?:LiLiQ-P-1\.1)/,/^(?:OLDAP-2\.0\.1)/,/^(?:OLDAP-2\.2\.1)/,/^(?:CNRI-Python)/,/^(?:XFree86-1\.1)/,/^(?:OSET-PL-2\.1)/,/^(?:Apache-2\.0)/,/^(?:Watcom-1\.0)/,/^(?:PostgreSQL)/,/^(?:Python-2\.0)/,/^(?:RHeCos-1\.1)/,/^(?:EUDatagrid)/,/^(?:Spencer-99)/,/^(?:Intel-ACPI)/,/^(?:CECILL-1\.0)/,/^(?:CECILL-1\.1)/,/^(?:JasPer-2\.0)/,/^(?:CECILL-2\.0)/,/^(?:CECILL-2\.1)/,/^(?:gSOAP-1\.3b)/,/^(?:Spencer-94)/,/^(?:Apache-1\.1)/,/^(?:Spencer-86)/,/^(?:Apache-1\.0)/,/^(?:ClArtistic)/,/^(?:TORQUE-1\.1)/,/^(?:CATOSL-1\.1)/,/^(?:Adobe-2006)/,/^(?:Zimbra-1\.4)/,/^(?:Zimbra-1\.3)/,/^(?:Condor-1\.1)/,/^(?:CC-BY-3\.0)/,/^(?:CC-BY-2\.5)/,/^(?:OLDAP-2\.4)/,/^(?:SGI-B-1\.1)/,/^(?:SISSL-1\.2)/,/^(?:SGI-B-1\.0)/,/^(?:OLDAP-2\.3)/,/^(?:CC-BY-4\.0)/,/^(?:Crossword)/,/^(?:SimPL-2\.0)/,/^(?:OLDAP-2\.2)/,/^(?:OLDAP-2\.1)/,/^(?:ErlPL-1\.1)/,/^(?:LPPL-1\.3a)/,/^(?:LPPL-1\.3c)/,/^(?:OLDAP-2\.0)/,/^(?:Leptonica)/,/^(?:CPOL-1\.02)/,/^(?:OLDAP-1\.4)/,/^(?:OLDAP-1\.3)/,/^(?:CC-BY-2\.0)/,/^(?:Unlicense)/,/^(?:OLDAP-2\.8)/,/^(?:OLDAP-1\.2)/,/^(?:MakeIndex)/,/^(?:OLDAP-2\.7)/,/^(?:OLDAP-1\.1)/,/^(?:Sleepycat)/,/^(?:D-FSL-1\.0)/,/^(?:CC-BY-1\.0)/,/^(?:OLDAP-2\.6)/,/^(?:WXwindows)/,/^(?:NPOSL-3\.0)/,/^(?:FreeImage)/,/^(?:SGI-B-2\.0)/,/^(?:OLDAP-2\.5)/,/^(?:Beerware)/,/^(?:Newsletr)/,/^(?:NBPL-1\.0)/,/^(?:NASA-1\.3)/,/^(?:NLOD-1\.0)/,/^(?:AGPL-1\.0)/,/^(?:OCLC-2\.0)/,/^(?:ODbL-1\.0)/,/^(?:PDDL-1\.0)/,/^(?:Motosoto)/,/^(?:Afmparse)/,/^(?:ANTLR-PD)/,/^(?:LPL-1\.02)/,/^(?:Abstyles)/,/^(?:eCos-2\.0)/,/^(?:APSL-1\.0)/,/^(?:LPPL-1\.2)/,/^(?:LPPL-1\.1)/,/^(?:LPPL-1\.0)/,/^(?:APSL-1\.1)/,/^(?:APSL-2\.0)/,/^(?:Info-ZIP)/,/^(?:Zend-2\.0)/,/^(?:IBM-pibs)/,/^(?:LGPL-2\.0)/,/^(?:LGPL-3\.0)/,/^(?:LGPL-2\.1)/,/^(?:GFDL-1\.3)/,/^(?:PHP-3\.01)/,/^(?:GFDL-1\.2)/,/^(?:GFDL-1\.1)/,/^(?:AGPL-3\.0)/,/^(?:Giftware)/,/^(?:EUPL-1\.1)/,/^(?:RPSL-1\.0)/,/^(?:EUPL-1\.0)/,/^(?:MIT-enna)/,/^(?:CECILL-B)/,/^(?:diffmark)/,/^(?:CECILL-C)/,/^(?:CDDL-1\.0)/,/^(?:Sendmail)/,/^(?:CDDL-1\.1)/,/^(?:CPAL-1\.0)/,/^(?:APSL-1\.2)/,/^(?:NPL-1\.1)/,/^(?:AFL-1\.2)/,/^(?:Caldera)/,/^(?:AFL-2\.0)/,/^(?:FSFULLR)/,/^(?:AFL-2\.1)/,/^(?:VSL-1\.0)/,/^(?:VOSTROM)/,/^(?:UPL-1\.0)/,/^(?:Dotseqn)/,/^(?:CPL-1\.0)/,/^(?:dvipdfm)/,/^(?:EPL-1\.0)/,/^(?:OCCT-PL)/,/^(?:ECL-1\.0)/,/^(?:Latex2e)/,/^(?:ECL-2\.0)/,/^(?:GPL-1\.0)/,/^(?:GPL-2\.0)/,/^(?:GPL-3\.0)/,/^(?:AFL-3\.0)/,/^(?:LAL-1\.2)/,/^(?:LAL-1\.3)/,/^(?:EFL-1\.0)/,/^(?:EFL-2\.0)/,/^(?:gnuplot)/,/^(?:Aladdin)/,/^(?:LPL-1\.0)/,/^(?:libtiff)/,/^(?:Entessa)/,/^(?:AMDPLPA)/,/^(?:IPL-1\.0)/,/^(?:OPL-1\.0)/,/^(?:OSL-1\.0)/,/^(?:OSL-1\.1)/,/^(?:OSL-2\.0)/,/^(?:OSL-2\.1)/,/^(?:OSL-3\.0)/,/^(?:OpenSSL)/,/^(?:ZPL-2\.1)/,/^(?:PHP-3\.0)/,/^(?:ZPL-2\.0)/,/^(?:ZPL-1\.1)/,/^(?:CC0-1\.0)/,/^(?:SPL-1\.0)/,/^(?:psutils)/,/^(?:MPL-1\.0)/,/^(?:QPL-1\.0)/,/^(?:MPL-1\.1)/,/^(?:MPL-2\.0)/,/^(?:APL-1\.0)/,/^(?:RPL-1\.1)/,/^(?:RPL-1\.5)/,/^(?:MIT-CMU)/,/^(?:Multics)/,/^(?:Eurosym)/,/^(?:BSL-1\.0)/,/^(?:MIT-feh)/,/^(?:Saxpath)/,/^(?:Borceux)/,/^(?:OFL-1\.1)/,/^(?:OFL-1\.0)/,/^(?:AFL-1\.1)/,/^(?:YPL-1\.1)/,/^(?:YPL-1\.0)/,/^(?:NPL-1\.0)/,/^(?:iMatix)/,/^(?:mpich2)/,/^(?:APAFML)/,/^(?:Bahyph)/,/^(?:RSA-MD)/,/^(?:psfrag)/,/^(?:Plexus)/,/^(?:eGenix)/,/^(?:Glulxe)/,/^(?:SAX-PD)/,/^(?:Imlib2)/,/^(?:Wsuipa)/,/^(?:LGPLLR)/,/^(?:Libpng)/,/^(?:xinetd)/,/^(?:MITNFA)/,/^(?:NetCDF)/,/^(?:Naumen)/,/^(?:SMPPL)/,/^(?:Nunit)/,/^(?:FSFUL)/,/^(?:GL2PS)/,/^(?:SMLNJ)/,/^(?:Rdisc)/,/^(?:Noweb)/,/^(?:Nokia)/,/^(?:SISSL)/,/^(?:Qhull)/,/^(?:Intel)/,/^(?:Glide)/,/^(?:Xerox)/,/^(?:AMPAS)/,/^(?:WTFPL)/,/^(?:MS-PL)/,/^(?:XSkat)/,/^(?:MS-RL)/,/^(?:MirOS)/,/^(?:RSCPL)/,/^(?:TMate)/,/^(?:OGTSL)/,/^(?:FSFAP)/,/^(?:NCSA)/,/^(?:Zlib)/,/^(?:SCEA)/,/^(?:SNIA)/,/^(?:NGPL)/,/^(?:NOSL)/,/^(?:ADSL)/,/^(?:MTLL)/,/^(?:NLPL)/,/^(?:Ruby)/,/^(?:JSON)/,/^(?:Barr)/,/^(?:0BSD)/,/^(?:Xnet)/,/^(?:Cube)/,/^(?:curl)/,/^(?:DSDP)/,/^(?:Fair)/,/^(?:HPND)/,/^(?:TOSL)/,/^(?:IJG)/,/^(?:SWL)/,/^(?:Vim)/,/^(?:FTL)/,/^(?:ICU)/,/^(?:OML)/,/^(?:NRL)/,/^(?:DOC)/,/^(?:TCL)/,/^(?:W3C)/,/^(?:NTP)/,/^(?:IPA)/,/^(?:ISC)/,/^(?:X11)/,/^(?:AAL)/,/^(?:AML)/,/^(?:xpp)/,/^(?:Zed)/,/^(?:MIT)/,/^(?:Mup)/], +conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364],"inclusive":true}} +}); +return lexer; +})(); +parser.lexer = lexer; +function Parser () { + this.yy = {}; +} +Parser.prototype = parser;parser.Parser = Parser; +return new Parser; +})(); + + +if (true) { +exports.parser = spdxparse; +exports.Parser = spdxparse.Parser; +exports.parse = function () { return spdxparse.parse.apply(spdxparse, arguments); }; +exports.main = function commonjsMain(args) { + if (!args[1]) { + console.log('Usage: '+args[0]+' FILE'); + process.exit(1); + } + var source = __webpack_require__(133).readFileSync(__webpack_require__(4).normalize(args[1]), "utf8"); + return exports.parser.parse(source); +}; +if ( true && __webpack_require__.c[__webpack_require__.s] === module) { + exports.main(process.argv.slice(1)); +} +} + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(114)(module))) + +/***/ }), +/* 193 */ +/***/ (function(module, exports, __webpack_require__) { + +var licenseIDs = __webpack_require__(194); + +function valid(string) { + return licenseIDs.indexOf(string) > -1; +} + +// Common transpositions of license identifier acronyms +var transpositions = [ + ['APGL', 'AGPL'], + ['Gpl', 'GPL'], + ['GLP', 'GPL'], + ['APL', 'Apache'], + ['ISD', 'ISC'], + ['GLP', 'GPL'], + ['IST', 'ISC'], + ['Claude', 'Clause'], + [' or later', '+'], + [' International', ''], + ['GNU', 'GPL'], + ['GUN', 'GPL'], + ['+', ''], + ['GNU GPL', 'GPL'], + ['GNU/GPL', 'GPL'], + ['GNU GLP', 'GPL'], + ['GNU General Public License', 'GPL'], + ['Gnu public license', 'GPL'], + ['GNU Public License', 'GPL'], + ['GNU GENERAL PUBLIC LICENSE', 'GPL'], + ['MTI', 'MIT'], + ['Mozilla Public License', 'MPL'], + ['WTH', 'WTF'], + ['-License', ''] +]; + +var TRANSPOSED = 0; +var CORRECT = 1; + +// Simple corrections to nearly valid identifiers. +var transforms = [ + // e.g. 'mit' + function(argument) { + return argument.toUpperCase(); + }, + // e.g. 'MIT ' + function(argument) { + return argument.trim(); + }, + // e.g. 'M.I.T.' + function(argument) { + return argument.replace(/\./g, ''); + }, + // e.g. 'Apache- 2.0' + function(argument) { + return argument.replace(/\s+/g, ''); + }, + // e.g. 'CC BY 4.0'' + function(argument) { + return argument.replace(/\s+/g, '-'); + }, + // e.g. 'LGPLv2.1' + function(argument) { + return argument.replace('v', '-'); + }, + // e.g. 'Apache 2.0' + function(argument) { + return argument.replace(/,?\s*(\d)/, '-$1'); + }, + // e.g. 'GPL 2' + function(argument) { + return argument.replace(/,?\s*(\d)/, '-$1.0'); + }, + // e.g. 'Apache Version 2.0' + function(argument) { + return argument.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/, '-$2'); + }, + // e.g. 'Apache Version 2' + function(argument) { + return argument.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/, '-$2.0'); + }, + // e.g. 'ZLIB' + function(argument) { + return argument[0].toUpperCase() + argument.slice(1); + }, + // e.g. 'MPL/2.0' + function(argument) { + return argument.replace('/', '-'); + }, + // e.g. 'Apache 2' + function(argument) { + return argument + .replace(/\s*V\s*(\d)/, '-$1') + .replace(/(\d)$/, '$1.0'); + }, + // e.g. 'GPL-2.0-' + function(argument) { + return argument.slice(0, argument.length - 1); + }, + // e.g. 'GPL2' + function(argument) { + return argument.replace(/(\d)$/, '-$1.0'); + }, + // e.g. 'BSD 3' + function(argument) { + return argument.replace(/(-| )?(\d)$/, '-$2-Clause'); + }, + // e.g. 'BSD clause 3' + function(argument) { + return argument.replace(/(-| )clause(-| )(\d)/, '-$3-Clause'); + }, + // e.g. 'BY-NC-4.0' + function(argument) { + return 'CC-' + argument; + }, + // e.g. 'BY-NC' + function(argument) { + return 'CC-' + argument + '-4.0'; + }, + // e.g. 'Attribution-NonCommercial' + function(argument) { + return argument + .replace('Attribution', 'BY') + .replace('NonCommercial', 'NC') + .replace('NoDerivatives', 'ND') + .replace(/ (\d)/, '-$1') + .replace(/ ?International/, ''); + }, + // e.g. 'Attribution-NonCommercial' + function(argument) { + return 'CC-' + + argument + .replace('Attribution', 'BY') + .replace('NonCommercial', 'NC') + .replace('NoDerivatives', 'ND') + .replace(/ (\d)/, '-$1') + .replace(/ ?International/, '') + + '-4.0'; + } +]; + +// If all else fails, guess that strings containing certain substrings +// meant to identify certain licenses. +var lastResorts = [ + ['UNLI', 'Unlicense'], + ['WTF', 'WTFPL'], + ['2 CLAUSE', 'BSD-2-Clause'], + ['2-CLAUSE', 'BSD-2-Clause'], + ['3 CLAUSE', 'BSD-3-Clause'], + ['3-CLAUSE', 'BSD-3-Clause'], + ['AFFERO', 'AGPL-3.0'], + ['AGPL', 'AGPL-3.0'], + ['APACHE', 'Apache-2.0'], + ['ARTISTIC', 'Artistic-2.0'], + ['Affero', 'AGPL-3.0'], + ['BEER', 'Beerware'], + ['BOOST', 'BSL-1.0'], + ['BSD', 'BSD-2-Clause'], + ['ECLIPSE', 'EPL-1.0'], + ['FUCK', 'WTFPL'], + ['GNU', 'GPL-3.0'], + ['LGPL', 'LGPL-3.0'], + ['GPL', 'GPL-3.0'], + ['MIT', 'MIT'], + ['MPL', 'MPL-2.0'], + ['X11', 'X11'], + ['ZLIB', 'Zlib'] +]; + +var SUBSTRING = 0; +var IDENTIFIER = 1; + +var validTransformation = function(identifier) { + for (var i = 0; i < transforms.length; i++) { + var transformed = transforms[i](identifier); + if (transformed !== identifier && valid(transformed)) { + return transformed; + } + } + return null; +}; + +var validLastResort = function(identifier) { + var upperCased = identifier.toUpperCase(); + for (var i = 0; i < lastResorts.length; i++) { + var lastResort = lastResorts[i]; + if (upperCased.indexOf(lastResort[SUBSTRING]) > -1) { + return lastResort[IDENTIFIER]; + } + } + return null; +}; + +var anyCorrection = function(identifier, check) { + for (var i = 0; i < transpositions.length; i++) { + var transposition = transpositions[i]; + var transposed = transposition[TRANSPOSED]; + if (identifier.indexOf(transposed) > -1) { + var corrected = identifier.replace( + transposed, + transposition[CORRECT] + ); + var checked = check(corrected); + if (checked !== null) { + return checked; + } + } + } + return null; +}; + +module.exports = function(identifier) { + identifier = identifier.replace(/\+$/, ''); + if (valid(identifier)) { + return identifier; + } + var transformed = validTransformation(identifier); + if (transformed !== null) { + return transformed; + } + transformed = anyCorrection(identifier, function(argument) { + if (valid(argument)) { + return argument; + } + return validTransformation(argument); + }); + if (transformed !== null) { + return transformed; + } + transformed = validLastResort(identifier); + if (transformed !== null) { + return transformed; + } + transformed = anyCorrection(identifier, validLastResort); + if (transformed !== null) { + return transformed; + } + return null; +}; + + +/***/ }), +/* 194 */ +/***/ (function(module) { + +module.exports = JSON.parse("[\"Glide\",\"Abstyles\",\"AFL-1.1\",\"AFL-1.2\",\"AFL-2.0\",\"AFL-2.1\",\"AFL-3.0\",\"AMPAS\",\"APL-1.0\",\"Adobe-Glyph\",\"APAFML\",\"Adobe-2006\",\"AGPL-1.0\",\"Afmparse\",\"Aladdin\",\"ADSL\",\"AMDPLPA\",\"ANTLR-PD\",\"Apache-1.0\",\"Apache-1.1\",\"Apache-2.0\",\"AML\",\"APSL-1.0\",\"APSL-1.1\",\"APSL-1.2\",\"APSL-2.0\",\"Artistic-1.0\",\"Artistic-1.0-Perl\",\"Artistic-1.0-cl8\",\"Artistic-2.0\",\"AAL\",\"Bahyph\",\"Barr\",\"Beerware\",\"BitTorrent-1.0\",\"BitTorrent-1.1\",\"BSL-1.0\",\"Borceux\",\"BSD-2-Clause\",\"BSD-2-Clause-FreeBSD\",\"BSD-2-Clause-NetBSD\",\"BSD-3-Clause\",\"BSD-3-Clause-Clear\",\"BSD-4-Clause\",\"BSD-Protection\",\"BSD-Source-Code\",\"BSD-3-Clause-Attribution\",\"0BSD\",\"BSD-4-Clause-UC\",\"bzip2-1.0.5\",\"bzip2-1.0.6\",\"Caldera\",\"CECILL-1.0\",\"CECILL-1.1\",\"CECILL-2.0\",\"CECILL-2.1\",\"CECILL-B\",\"CECILL-C\",\"ClArtistic\",\"MIT-CMU\",\"CNRI-Jython\",\"CNRI-Python\",\"CNRI-Python-GPL-Compatible\",\"CPOL-1.02\",\"CDDL-1.0\",\"CDDL-1.1\",\"CPAL-1.0\",\"CPL-1.0\",\"CATOSL-1.1\",\"Condor-1.1\",\"CC-BY-1.0\",\"CC-BY-2.0\",\"CC-BY-2.5\",\"CC-BY-3.0\",\"CC-BY-4.0\",\"CC-BY-ND-1.0\",\"CC-BY-ND-2.0\",\"CC-BY-ND-2.5\",\"CC-BY-ND-3.0\",\"CC-BY-ND-4.0\",\"CC-BY-NC-1.0\",\"CC-BY-NC-2.0\",\"CC-BY-NC-2.5\",\"CC-BY-NC-3.0\",\"CC-BY-NC-4.0\",\"CC-BY-NC-ND-1.0\",\"CC-BY-NC-ND-2.0\",\"CC-BY-NC-ND-2.5\",\"CC-BY-NC-ND-3.0\",\"CC-BY-NC-ND-4.0\",\"CC-BY-NC-SA-1.0\",\"CC-BY-NC-SA-2.0\",\"CC-BY-NC-SA-2.5\",\"CC-BY-NC-SA-3.0\",\"CC-BY-NC-SA-4.0\",\"CC-BY-SA-1.0\",\"CC-BY-SA-2.0\",\"CC-BY-SA-2.5\",\"CC-BY-SA-3.0\",\"CC-BY-SA-4.0\",\"CC0-1.0\",\"Crossword\",\"CrystalStacker\",\"CUA-OPL-1.0\",\"Cube\",\"curl\",\"D-FSL-1.0\",\"diffmark\",\"WTFPL\",\"DOC\",\"Dotseqn\",\"DSDP\",\"dvipdfm\",\"EPL-1.0\",\"ECL-1.0\",\"ECL-2.0\",\"eGenix\",\"EFL-1.0\",\"EFL-2.0\",\"MIT-advertising\",\"MIT-enna\",\"Entessa\",\"ErlPL-1.1\",\"EUDatagrid\",\"EUPL-1.0\",\"EUPL-1.1\",\"Eurosym\",\"Fair\",\"MIT-feh\",\"Frameworx-1.0\",\"FreeImage\",\"FTL\",\"FSFAP\",\"FSFUL\",\"FSFULLR\",\"Giftware\",\"GL2PS\",\"Glulxe\",\"AGPL-3.0\",\"GFDL-1.1\",\"GFDL-1.2\",\"GFDL-1.3\",\"GPL-1.0\",\"GPL-2.0\",\"GPL-3.0\",\"LGPL-2.1\",\"LGPL-3.0\",\"LGPL-2.0\",\"gnuplot\",\"gSOAP-1.3b\",\"HaskellReport\",\"HPND\",\"IBM-pibs\",\"IPL-1.0\",\"ICU\",\"ImageMagick\",\"iMatix\",\"Imlib2\",\"IJG\",\"Info-ZIP\",\"Intel-ACPI\",\"Intel\",\"Interbase-1.0\",\"IPA\",\"ISC\",\"JasPer-2.0\",\"JSON\",\"LPPL-1.0\",\"LPPL-1.1\",\"LPPL-1.2\",\"LPPL-1.3a\",\"LPPL-1.3c\",\"Latex2e\",\"BSD-3-Clause-LBNL\",\"Leptonica\",\"LGPLLR\",\"Libpng\",\"libtiff\",\"LAL-1.2\",\"LAL-1.3\",\"LiLiQ-P-1.1\",\"LiLiQ-Rplus-1.1\",\"LiLiQ-R-1.1\",\"LPL-1.02\",\"LPL-1.0\",\"MakeIndex\",\"MTLL\",\"MS-PL\",\"MS-RL\",\"MirOS\",\"MITNFA\",\"MIT\",\"Motosoto\",\"MPL-1.0\",\"MPL-1.1\",\"MPL-2.0\",\"MPL-2.0-no-copyleft-exception\",\"mpich2\",\"Multics\",\"Mup\",\"NASA-1.3\",\"Naumen\",\"NBPL-1.0\",\"NetCDF\",\"NGPL\",\"NOSL\",\"NPL-1.0\",\"NPL-1.1\",\"Newsletr\",\"NLPL\",\"Nokia\",\"NPOSL-3.0\",\"NLOD-1.0\",\"Noweb\",\"NRL\",\"NTP\",\"Nunit\",\"OCLC-2.0\",\"ODbL-1.0\",\"PDDL-1.0\",\"OCCT-PL\",\"OGTSL\",\"OLDAP-2.2.2\",\"OLDAP-1.1\",\"OLDAP-1.2\",\"OLDAP-1.3\",\"OLDAP-1.4\",\"OLDAP-2.0\",\"OLDAP-2.0.1\",\"OLDAP-2.1\",\"OLDAP-2.2\",\"OLDAP-2.2.1\",\"OLDAP-2.3\",\"OLDAP-2.4\",\"OLDAP-2.5\",\"OLDAP-2.6\",\"OLDAP-2.7\",\"OLDAP-2.8\",\"OML\",\"OPL-1.0\",\"OSL-1.0\",\"OSL-1.1\",\"OSL-2.0\",\"OSL-2.1\",\"OSL-3.0\",\"OpenSSL\",\"OSET-PL-2.1\",\"PHP-3.0\",\"PHP-3.01\",\"Plexus\",\"PostgreSQL\",\"psfrag\",\"psutils\",\"Python-2.0\",\"QPL-1.0\",\"Qhull\",\"Rdisc\",\"RPSL-1.0\",\"RPL-1.1\",\"RPL-1.5\",\"RHeCos-1.1\",\"RSCPL\",\"RSA-MD\",\"Ruby\",\"SAX-PD\",\"Saxpath\",\"SCEA\",\"SWL\",\"SMPPL\",\"Sendmail\",\"SGI-B-1.0\",\"SGI-B-1.1\",\"SGI-B-2.0\",\"OFL-1.0\",\"OFL-1.1\",\"SimPL-2.0\",\"Sleepycat\",\"SNIA\",\"Spencer-86\",\"Spencer-94\",\"Spencer-99\",\"SMLNJ\",\"SugarCRM-1.1.3\",\"SISSL\",\"SISSL-1.2\",\"SPL-1.0\",\"Watcom-1.0\",\"TCL\",\"Unlicense\",\"TMate\",\"TORQUE-1.1\",\"TOSL\",\"Unicode-TOU\",\"UPL-1.0\",\"NCSA\",\"Vim\",\"VOSTROM\",\"VSL-1.0\",\"W3C-19980720\",\"W3C\",\"Wsuipa\",\"Xnet\",\"X11\",\"Xerox\",\"XFree86-1.1\",\"xinetd\",\"xpp\",\"XSkat\",\"YPL-1.0\",\"YPL-1.1\",\"Zed\",\"Zend-2.0\",\"Zimbra-1.3\",\"Zimbra-1.4\",\"Zlib\",\"zlib-acknowledgement\",\"ZPL-1.1\",\"ZPL-2.0\",\"ZPL-2.1\",\"BSD-3-Clause-No-Nuclear-License\",\"BSD-3-Clause-No-Nuclear-Warranty\",\"BSD-3-Clause-No-Nuclear-License-2014\",\"eCos-2.0\",\"GPL-2.0-with-autoconf-exception\",\"GPL-2.0-with-bison-exception\",\"GPL-2.0-with-classpath-exception\",\"GPL-2.0-with-font-exception\",\"GPL-2.0-with-GCC-exception\",\"GPL-3.0-with-autoconf-exception\",\"GPL-3.0-with-GCC-exception\",\"StandardML-NJ\",\"WXwindows\"]"); + +/***/ }), +/* 195 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var url = __webpack_require__(196) +var gitHosts = __webpack_require__(197) +var GitHost = module.exports = __webpack_require__(198) + +var protocolToRepresentationMap = { + 'git+ssh': 'sshurl', + 'git+https': 'https', + 'ssh': 'sshurl', + 'git': 'git' +} + +function protocolToRepresentation (protocol) { + if (protocol.substr(-1) === ':') protocol = protocol.slice(0, -1) + return protocolToRepresentationMap[protocol] || protocol +} + +var authProtocols = { + 'git:': true, + 'https:': true, + 'git+https:': true, + 'http:': true, + 'git+http:': true +} + +var cache = {} + +module.exports.fromUrl = function (giturl, opts) { + var key = giturl + JSON.stringify(opts || {}) + + if (!(key in cache)) { + cache[key] = fromUrl(giturl, opts) + } + + return cache[key] +} + +function fromUrl (giturl, opts) { + if (giturl == null || giturl === '') return + var url = fixupUnqualifiedGist( + isGitHubShorthand(giturl) ? 'github:' + giturl : giturl + ) + var parsed = parseGitUrl(url) + var shortcutMatch = url.match(new RegExp('^([^:]+):(?:(?:[^@:]+(?:[^@]+)?@)?([^/]*))[/](.+?)(?:[.]git)?($|#)')) + var matches = Object.keys(gitHosts).map(function (gitHostName) { + try { + var gitHostInfo = gitHosts[gitHostName] + var auth = null + if (parsed.auth && authProtocols[parsed.protocol]) { + auth = decodeURIComponent(parsed.auth) + } + var committish = parsed.hash ? decodeURIComponent(parsed.hash.substr(1)) : null + var user = null + var project = null + var defaultRepresentation = null + if (shortcutMatch && shortcutMatch[1] === gitHostName) { + user = shortcutMatch[2] && decodeURIComponent(shortcutMatch[2]) + project = decodeURIComponent(shortcutMatch[3]) + defaultRepresentation = 'shortcut' + } else { + if (parsed.host !== gitHostInfo.domain) return + if (!gitHostInfo.protocols_re.test(parsed.protocol)) return + if (!parsed.path) return + var pathmatch = gitHostInfo.pathmatch + var matched = parsed.path.match(pathmatch) + if (!matched) return + if (matched[1] != null) user = decodeURIComponent(matched[1].replace(/^:/, '')) + if (matched[2] != null) project = decodeURIComponent(matched[2]) + defaultRepresentation = protocolToRepresentation(parsed.protocol) + } + return new GitHost(gitHostName, user, auth, project, committish, defaultRepresentation, opts) + } catch (ex) { + if (!(ex instanceof URIError)) throw ex + } + }).filter(function (gitHostInfo) { return gitHostInfo }) + if (matches.length !== 1) return + return matches[0] +} + +function isGitHubShorthand (arg) { + // Note: This does not fully test the git ref format. + // See https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html + // + // The only way to do this properly would be to shell out to + // git-check-ref-format, and as this is a fast sync function, + // we don't want to do that. Just let git fail if it turns + // out that the commit-ish is invalid. + // GH usernames cannot start with . or - + return /^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(arg) +} + +function fixupUnqualifiedGist (giturl) { + // necessary for round-tripping gists + var parsed = url.parse(giturl) + if (parsed.protocol === 'gist:' && parsed.host && !parsed.path) { + return parsed.protocol + '/' + parsed.host + } else { + return giturl + } +} + +function parseGitUrl (giturl) { + if (typeof giturl !== 'string') giturl = '' + giturl + var matched = giturl.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/) + if (!matched) return url.parse(giturl) + return { + protocol: 'git+ssh:', + slashes: true, + auth: matched[1], + host: matched[2], + port: null, + hostname: matched[2], + hash: matched[4], + search: null, + query: null, + pathname: '/' + matched[3], + path: '/' + matched[3], + href: 'git+ssh://' + matched[1] + '@' + matched[2] + + '/' + matched[3] + (matched[4] || '') + } +} + + +/***/ }), +/* 196 */ +/***/ (function(module, exports) { + +module.exports = require("url"); + +/***/ }), +/* 197 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var gitHosts = module.exports = { + github: { + // First two are insecure and generally shouldn't be used any more, but + // they are still supported. + 'protocols': [ 'git', 'http', 'git+ssh', 'git+https', 'ssh', 'https' ], + 'domain': 'github.com', + 'treepath': 'tree', + 'filetemplate': 'https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}', + 'bugstemplate': 'https://{domain}/{user}/{project}/issues', + 'gittemplate': 'git://{auth@}{domain}/{user}/{project}.git{#committish}', + 'tarballtemplate': 'https://{domain}/{user}/{project}/archive/{committish}.tar.gz' + }, + bitbucket: { + 'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ], + 'domain': 'bitbucket.org', + 'treepath': 'src', + 'tarballtemplate': 'https://{domain}/{user}/{project}/get/{committish}.tar.gz' + }, + gitlab: { + 'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ], + 'domain': 'gitlab.com', + 'treepath': 'tree', + 'docstemplate': 'https://{domain}/{user}/{project}{/tree/committish}#README', + 'bugstemplate': 'https://{domain}/{user}/{project}/issues', + 'tarballtemplate': 'https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}' + }, + gist: { + 'protocols': [ 'git', 'git+ssh', 'git+https', 'ssh', 'https' ], + 'domain': 'gist.github.com', + 'pathmatch': /^[/](?:([^/]+)[/])?([a-z0-9]+)(?:[.]git)?$/, + 'filetemplate': 'https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}', + 'bugstemplate': 'https://{domain}/{project}', + 'gittemplate': 'git://{domain}/{project}.git{#committish}', + 'sshtemplate': 'git@{domain}:/{project}.git{#committish}', + 'sshurltemplate': 'git+ssh://git@{domain}/{project}.git{#committish}', + 'browsetemplate': 'https://{domain}/{project}{/committish}', + 'docstemplate': 'https://{domain}/{project}{/committish}', + 'httpstemplate': 'git+https://{domain}/{project}.git{#committish}', + 'shortcuttemplate': '{type}:{project}{#committish}', + 'pathtemplate': '{project}{#committish}', + 'tarballtemplate': 'https://{domain}/{user}/{project}/archive/{committish}.tar.gz' + } +} + +var gitHostDefaults = { + 'sshtemplate': 'git@{domain}:{user}/{project}.git{#committish}', + 'sshurltemplate': 'git+ssh://git@{domain}/{user}/{project}.git{#committish}', + 'browsetemplate': 'https://{domain}/{user}/{project}{/tree/committish}', + 'docstemplate': 'https://{domain}/{user}/{project}{/tree/committish}#readme', + 'httpstemplate': 'git+https://{auth@}{domain}/{user}/{project}.git{#committish}', + 'filetemplate': 'https://{domain}/{user}/{project}/raw/{committish}/{path}', + 'shortcuttemplate': '{type}:{user}/{project}{#committish}', + 'pathtemplate': '{user}/{project}{#committish}', + 'pathmatch': /^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/ +} + +Object.keys(gitHosts).forEach(function (name) { + Object.keys(gitHostDefaults).forEach(function (key) { + if (gitHosts[name][key]) return + gitHosts[name][key] = gitHostDefaults[key] + }) + gitHosts[name].protocols_re = RegExp('^(' + + gitHosts[name].protocols.map(function (protocol) { + return protocol.replace(/([\\+*{}()[\]$^|])/g, '\\$1') + }).join('|') + '):$') +}) + + +/***/ }), +/* 198 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var gitHosts = __webpack_require__(197) +var extend = Object.assign || __webpack_require__(111)._extend + +var GitHost = module.exports = function (type, user, auth, project, committish, defaultRepresentation, opts) { + var gitHostInfo = this + gitHostInfo.type = type + Object.keys(gitHosts[type]).forEach(function (key) { + gitHostInfo[key] = gitHosts[type][key] + }) + gitHostInfo.user = user + gitHostInfo.auth = auth + gitHostInfo.project = project + gitHostInfo.committish = committish + gitHostInfo.default = defaultRepresentation + gitHostInfo.opts = opts || {} +} +GitHost.prototype = {} + +GitHost.prototype.hash = function () { + return this.committish ? '#' + this.committish : '' +} + +GitHost.prototype._fill = function (template, opts) { + if (!template) return + var vars = extend({}, opts) + opts = extend(extend({}, this.opts), opts) + var self = this + Object.keys(this).forEach(function (key) { + if (self[key] != null && vars[key] == null) vars[key] = self[key] + }) + var rawAuth = vars.auth + var rawComittish = vars.committish + Object.keys(vars).forEach(function (key) { + vars[key] = encodeURIComponent(vars[key]) + }) + vars['auth@'] = rawAuth ? rawAuth + '@' : '' + if (opts.noCommittish) { + vars['#committish'] = '' + vars['/tree/committish'] = '' + vars['/comittish'] = '' + vars.comittish = '' + } else { + vars['#committish'] = rawComittish ? '#' + rawComittish : '' + vars['/tree/committish'] = vars.committish + ? '/' + vars.treepath + '/' + vars.committish + : '' + vars['/committish'] = vars.committish ? '/' + vars.committish : '' + vars.committish = vars.committish || 'master' + } + var res = template + Object.keys(vars).forEach(function (key) { + res = res.replace(new RegExp('[{]' + key + '[}]', 'g'), vars[key]) + }) + if (opts.noGitPlus) { + return res.replace(/^git[+]/, '') + } else { + return res + } +} + +GitHost.prototype.ssh = function (opts) { + return this._fill(this.sshtemplate, opts) +} + +GitHost.prototype.sshurl = function (opts) { + return this._fill(this.sshurltemplate, opts) +} + +GitHost.prototype.browse = function (opts) { + return this._fill(this.browsetemplate, opts) +} + +GitHost.prototype.docs = function (opts) { + return this._fill(this.docstemplate, opts) +} + +GitHost.prototype.bugs = function (opts) { + return this._fill(this.bugstemplate, opts) +} + +GitHost.prototype.https = function (opts) { + return this._fill(this.httpstemplate, opts) +} + +GitHost.prototype.git = function (opts) { + return this._fill(this.gittemplate, opts) +} + +GitHost.prototype.shortcut = function (opts) { + return this._fill(this.shortcuttemplate, opts) +} + +GitHost.prototype.path = function (opts) { + return this._fill(this.pathtemplate, opts) +} + +GitHost.prototype.tarball = function (opts) { + return this._fill(this.tarballtemplate, opts) +} + +GitHost.prototype.file = function (P, opts) { + return this._fill(this.filetemplate, extend({ + path: P.replace(/^[/]+/g, '') + }, opts)) +} + +GitHost.prototype.getDefaultRepresentation = function () { + return this.default +} + +GitHost.prototype.toString = function (opts) { + return (this[this.default] || this.sshurl).call(this, opts) +} + + +/***/ }), +/* 199 */ +/***/ (function(module, exports, __webpack_require__) { + +var async = __webpack_require__(200); +async.core = __webpack_require__(206); +async.isCore = __webpack_require__(205); +async.sync = __webpack_require__(208); + +module.exports = async; + + +/***/ }), +/* 200 */ +/***/ (function(module, exports, __webpack_require__) { + +var fs = __webpack_require__(133); +var path = __webpack_require__(4); +var caller = __webpack_require__(201); +var nodeModulesPaths = __webpack_require__(202); +var normalizeOptions = __webpack_require__(204); +var isCore = __webpack_require__(205); + +var realpathFS = fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; + +var defaultIsFile = function isFile(file, cb) { + fs.stat(file, function (err, stat) { + if (!err) { + return cb(null, stat.isFile() || stat.isFIFO()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); +}; + +var defaultIsDir = function isDirectory(dir, cb) { + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); +}; + +var defaultRealpath = function realpath(x, cb) { + realpathFS(x, function (realpathErr, realPath) { + if (realpathErr && realpathErr.code !== 'ENOENT') cb(realpathErr); + else cb(null, realpathErr ? x : realPath); + }); +}; + +var maybeRealpath = function maybeRealpath(realpath, x, opts, cb) { + if (opts && opts.preserveSymlinks === false) { + realpath(x, cb); + } else { + cb(null, x); + } +}; + +var getPackageCandidates = function getPackageCandidates(x, start, opts) { + var dirs = nodeModulesPaths(start, opts, x); + for (var i = 0; i < dirs.length; i++) { + dirs[i] = path.join(dirs[i], x); + } + return dirs; +}; + +module.exports = function resolve(x, options, callback) { + var cb = callback; + var opts = options; + if (typeof options === 'function') { + cb = opts; + opts = {}; + } + if (typeof x !== 'string') { + var err = new TypeError('Path must be a string.'); + return process.nextTick(function () { + cb(err); + }); + } + + opts = normalizeOptions(x, opts); + + var isFile = opts.isFile || defaultIsFile; + var isDirectory = opts.isDirectory || defaultIsDir; + var readFile = opts.readFile || fs.readFile; + var realpath = opts.realpath || defaultRealpath; + var packageIterator = opts.packageIterator; + + var extensions = opts.extensions || ['.js']; + var basedir = opts.basedir || path.dirname(caller()); + var parent = opts.filename || basedir; + + opts.paths = opts.paths || []; + + // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory + var absoluteStart = path.resolve(basedir); + + maybeRealpath( + realpath, + absoluteStart, + opts, + function (err, realStart) { + if (err) cb(err); + else init(realStart); + } + ); + + var res; + function init(basedir) { + if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { + res = path.resolve(basedir, x); + if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; + if ((/\/$/).test(x) && res === basedir) { + loadAsDirectory(res, opts.package, onfile); + } else loadAsFile(res, opts.package, onfile); + } else if (isCore(x)) { + return cb(null, x); + } else loadNodeModules(x, basedir, function (err, n, pkg) { + if (err) cb(err); + else if (n) { + return maybeRealpath(realpath, n, opts, function (err, realN) { + if (err) { + cb(err); + } else { + cb(null, realN, pkg); + } + }); + } else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + } + + function onfile(err, m, pkg) { + if (err) cb(err); + else if (m) cb(null, m, pkg); + else loadAsDirectory(res, function (err, d, pkg) { + if (err) cb(err); + else if (d) { + maybeRealpath(realpath, d, opts, function (err, realD) { + if (err) { + cb(err); + } else { + cb(null, realD, pkg); + } + }); + } else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + } + + function loadAsFile(x, thePackage, callback) { + var loadAsFilePackage = thePackage; + var cb = callback; + if (typeof loadAsFilePackage === 'function') { + cb = loadAsFilePackage; + loadAsFilePackage = undefined; + } + + var exts = [''].concat(extensions); + load(exts, x, loadAsFilePackage); + + function load(exts, x, loadPackage) { + if (exts.length === 0) return cb(null, undefined, loadPackage); + var file = x + exts[0]; + + var pkg = loadPackage; + if (pkg) onpkg(null, pkg); + else loadpkg(path.dirname(file), onpkg); + + function onpkg(err, pkg_, dir) { + pkg = pkg_; + if (err) return cb(err); + if (dir && pkg && opts.pathFilter) { + var rfile = path.relative(dir, file); + var rel = rfile.slice(0, rfile.length - exts[0].length); + var r = opts.pathFilter(pkg, x, rel); + if (r) return load( + [''].concat(extensions.slice()), + path.resolve(dir, r), + pkg + ); + } + isFile(file, onex); + } + function onex(err, ex) { + if (err) return cb(err); + if (ex) return cb(null, file, pkg); + load(exts.slice(1), x, pkg); + } + } + } + + function loadpkg(dir, cb) { + if (dir === '' || dir === '/') return cb(null); + if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { + return cb(null); + } + if ((/[/\\]node_modules[/\\]*$/).test(dir)) return cb(null); + + maybeRealpath(realpath, dir, opts, function (unwrapErr, pkgdir) { + if (unwrapErr) return loadpkg(path.dirname(dir), cb); + var pkgfile = path.join(pkgdir, 'package.json'); + isFile(pkgfile, function (err, ex) { + // on err, ex is false + if (!ex) return loadpkg(path.dirname(dir), cb); + + readFile(pkgfile, function (err, body) { + if (err) cb(err); + try { var pkg = JSON.parse(body); } catch (jsonErr) {} + + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + cb(null, pkg, dir); + }); + }); + }); + } + + function loadAsDirectory(x, loadAsDirectoryPackage, callback) { + var cb = callback; + var fpkg = loadAsDirectoryPackage; + if (typeof fpkg === 'function') { + cb = fpkg; + fpkg = opts.package; + } + + maybeRealpath(realpath, x, opts, function (unwrapErr, pkgdir) { + if (unwrapErr) return cb(unwrapErr); + var pkgfile = path.join(pkgdir, 'package.json'); + isFile(pkgfile, function (err, ex) { + if (err) return cb(err); + if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb); + + readFile(pkgfile, function (err, body) { + if (err) return cb(err); + try { + var pkg = JSON.parse(body); + } catch (jsonErr) {} + + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + + if (pkg && pkg.main) { + if (typeof pkg.main !== 'string') { + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); + mainError.code = 'INVALID_PACKAGE_MAIN'; + return cb(mainError); + } + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb); + + var dir = path.resolve(x, pkg.main); + loadAsDirectory(dir, pkg, function (err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + loadAsFile(path.join(x, 'index'), pkg, cb); + }); + }); + return; + } + + loadAsFile(path.join(x, '/index'), pkg, cb); + }); + }); + }); + } + + function processDirs(cb, dirs) { + if (dirs.length === 0) return cb(null, undefined); + var dir = dirs[0]; + + isDirectory(path.dirname(dir), isdir); + + function isdir(err, isdir) { + if (err) return cb(err); + if (!isdir) return processDirs(cb, dirs.slice(1)); + loadAsFile(dir, opts.package, onfile); + } + + function onfile(err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + loadAsDirectory(dir, opts.package, ondir); + } + + function ondir(err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + processDirs(cb, dirs.slice(1)); + } + } + function loadNodeModules(x, start, cb) { + var thunk = function () { return getPackageCandidates(x, start, opts); }; + processDirs( + cb, + packageIterator ? packageIterator(x, start, thunk, opts) : thunk() + ); + } +}; + + +/***/ }), +/* 201 */ +/***/ (function(module, exports) { + +module.exports = function () { + // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi + var origPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = function (_, stack) { return stack; }; + var stack = (new Error()).stack; + Error.prepareStackTrace = origPrepareStackTrace; + return stack[2].getFileName(); +}; + + +/***/ }), +/* 202 */ +/***/ (function(module, exports, __webpack_require__) { + +var path = __webpack_require__(4); +var parse = path.parse || __webpack_require__(203); + +var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) { + var prefix = '/'; + if ((/^([A-Za-z]:)/).test(absoluteStart)) { + prefix = ''; + } else if ((/^\\\\/).test(absoluteStart)) { + prefix = '\\\\'; + } + + var paths = [absoluteStart]; + var parsed = parse(absoluteStart); + while (parsed.dir !== paths[paths.length - 1]) { + paths.push(parsed.dir); + parsed = parse(parsed.dir); + } + + return paths.reduce(function (dirs, aPath) { + return dirs.concat(modules.map(function (moduleDir) { + return path.resolve(prefix, aPath, moduleDir); + })); + }, []); +}; + +module.exports = function nodeModulesPaths(start, opts, request) { + var modules = opts && opts.moduleDirectory + ? [].concat(opts.moduleDirectory) + : ['node_modules']; + + if (opts && typeof opts.paths === 'function') { + return opts.paths( + request, + start, + function () { return getNodeModulesDirs(start, modules); }, + opts + ); + } + + var dirs = getNodeModulesDirs(start, modules); + return opts && opts.paths ? dirs.concat(opts.paths) : dirs; +}; + + +/***/ }), +/* 203 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var isWindows = process.platform === 'win32'; + +// Regex to split a windows path into three parts: [*, device, slash, +// tail] windows-only +var splitDeviceRe = + /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + +// Regex to split the tail part of the above into [*, dir, basename, ext] +var splitTailRe = + /^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/; + +var win32 = {}; + +// Function to split a filename into [root, dir, basename, ext] +function win32SplitPath(filename) { + // Separate device+slash from tail + var result = splitDeviceRe.exec(filename), + device = (result[1] || '') + (result[2] || ''), + tail = result[3] || ''; + // Split the tail into dir, basename and extension + var result2 = splitTailRe.exec(tail), + dir = result2[1], + basename = result2[2], + ext = result2[3]; + return [device, dir, basename, ext]; +} + +win32.parse = function(pathString) { + if (typeof pathString !== 'string') { + throw new TypeError( + "Parameter 'pathString' must be a string, not " + typeof pathString + ); + } + var allParts = win32SplitPath(pathString); + if (!allParts || allParts.length !== 4) { + throw new TypeError("Invalid path '" + pathString + "'"); + } + return { + root: allParts[0], + dir: allParts[0] + allParts[1].slice(0, -1), + base: allParts[2], + ext: allParts[3], + name: allParts[2].slice(0, allParts[2].length - allParts[3].length) + }; +}; + + + +// Split a filename into [root, dir, basename, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; +var posix = {}; + + +function posixSplitPath(filename) { + return splitPathRe.exec(filename).slice(1); +} + + +posix.parse = function(pathString) { + if (typeof pathString !== 'string') { + throw new TypeError( + "Parameter 'pathString' must be a string, not " + typeof pathString + ); + } + var allParts = posixSplitPath(pathString); + if (!allParts || allParts.length !== 4) { + throw new TypeError("Invalid path '" + pathString + "'"); + } + allParts[1] = allParts[1] || ''; + allParts[2] = allParts[2] || ''; + allParts[3] = allParts[3] || ''; + + return { + root: allParts[0], + dir: allParts[0] + allParts[1].slice(0, -1), + base: allParts[2], + ext: allParts[3], + name: allParts[2].slice(0, allParts[2].length - allParts[3].length) + }; +}; + + +if (isWindows) + module.exports = win32.parse; +else /* posix */ + module.exports = posix.parse; + +module.exports.posix = posix.parse; +module.exports.win32 = win32.parse; + + +/***/ }), +/* 204 */ +/***/ (function(module, exports) { + +module.exports = function (x, opts) { + /** + * This file is purposefully a passthrough. It's expected that third-party + * environments will override it at runtime in order to inject special logic + * into `resolve` (by manipulating the options). One such example is the PnP + * code path in Yarn. + */ + + return opts || {}; +}; + + +/***/ }), +/* 205 */ +/***/ (function(module, exports, __webpack_require__) { + +var core = __webpack_require__(206); + +module.exports = function isCore(x) { + return Object.prototype.hasOwnProperty.call(core, x); +}; + + +/***/ }), +/* 206 */ +/***/ (function(module, exports, __webpack_require__) { + +var current = (process.versions && process.versions.node && process.versions.node.split('.')) || []; + +function specifierIncluded(specifier) { + var parts = specifier.split(' '); + var op = parts.length > 1 ? parts[0] : '='; + var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.'); + + for (var i = 0; i < 3; ++i) { + var cur = Number(current[i] || 0); + var ver = Number(versionParts[i] || 0); + if (cur === ver) { + continue; // eslint-disable-line no-restricted-syntax, no-continue + } + if (op === '<') { + return cur < ver; + } else if (op === '>=') { + return cur >= ver; + } else { + return false; + } + } + return op === '>='; +} + +function matchesRange(range) { + var specifiers = range.split(/ ?&& ?/); + if (specifiers.length === 0) { return false; } + for (var i = 0; i < specifiers.length; ++i) { + if (!specifierIncluded(specifiers[i])) { return false; } + } + return true; +} + +function versionIncluded(specifierValue) { + if (typeof specifierValue === 'boolean') { return specifierValue; } + if (specifierValue && typeof specifierValue === 'object') { + for (var i = 0; i < specifierValue.length; ++i) { + if (matchesRange(specifierValue[i])) { return true; } + } + return false; + } + return matchesRange(specifierValue); +} + +var data = __webpack_require__(207); + +var core = {}; +for (var mod in data) { // eslint-disable-line no-restricted-syntax + if (Object.prototype.hasOwnProperty.call(data, mod)) { + core[mod] = versionIncluded(data[mod]); + } +} +module.exports = core; + + +/***/ }), +/* 207 */ +/***/ (function(module) { + +module.exports = JSON.parse("{\"assert\":true,\"async_hooks\":\">= 8\",\"buffer_ieee754\":\"< 0.9.7\",\"buffer\":true,\"child_process\":true,\"cluster\":true,\"console\":true,\"constants\":true,\"crypto\":true,\"_debug_agent\":\">= 1 && < 8\",\"_debugger\":\"< 8\",\"dgram\":true,\"dns\":true,\"domain\":true,\"events\":true,\"freelist\":\"< 6\",\"fs\":true,\"fs/promises\":[\">= 10 && < 10.1\",\">= 14\"],\"_http_agent\":\">= 0.11.1\",\"_http_client\":\">= 0.11.1\",\"_http_common\":\">= 0.11.1\",\"_http_incoming\":\">= 0.11.1\",\"_http_outgoing\":\">= 0.11.1\",\"_http_server\":\">= 0.11.1\",\"http\":true,\"http2\":\">= 8.8\",\"https\":true,\"inspector\":\">= 8.0.0\",\"_linklist\":\"< 8\",\"module\":true,\"net\":true,\"node-inspect/lib/_inspect\":\">= 7.6.0 && < 12\",\"node-inspect/lib/internal/inspect_client\":\">= 7.6.0 && < 12\",\"node-inspect/lib/internal/inspect_repl\":\">= 7.6.0 && < 12\",\"os\":true,\"path\":true,\"perf_hooks\":\">= 8.5\",\"process\":\">= 1\",\"punycode\":true,\"querystring\":true,\"readline\":true,\"repl\":true,\"smalloc\":\">= 0.11.5 && < 3\",\"_stream_duplex\":\">= 0.9.4\",\"_stream_transform\":\">= 0.9.4\",\"_stream_wrap\":\">= 1.4.1\",\"_stream_passthrough\":\">= 0.9.4\",\"_stream_readable\":\">= 0.9.4\",\"_stream_writable\":\">= 0.9.4\",\"stream\":true,\"string_decoder\":true,\"sys\":true,\"timers\":true,\"_tls_common\":\">= 0.11.13\",\"_tls_legacy\":\">= 0.11.3 && < 10\",\"_tls_wrap\":\">= 0.11.3\",\"tls\":true,\"trace_events\":\">= 10\",\"tty\":true,\"url\":true,\"util\":true,\"v8/tools/arguments\":\">= 10 && < 12\",\"v8/tools/codemap\":[\">= 4.4.0 && < 5\",\">= 5.2.0 && < 12\"],\"v8/tools/consarray\":[\">= 4.4.0 && < 5\",\">= 5.2.0 && < 12\"],\"v8/tools/csvparser\":[\">= 4.4.0 && < 5\",\">= 5.2.0 && < 12\"],\"v8/tools/logreader\":[\">= 4.4.0 && < 5\",\">= 5.2.0 && < 12\"],\"v8/tools/profile_view\":[\">= 4.4.0 && < 5\",\">= 5.2.0 && < 12\"],\"v8/tools/splaytree\":[\">= 4.4.0 && < 5\",\">= 5.2.0 && < 12\"],\"v8\":\">= 1\",\"vm\":true,\"wasi\":\">= 13.4 && < 13.5\",\"worker_threads\":\">= 11.7\",\"zlib\":true}"); + +/***/ }), +/* 208 */ +/***/ (function(module, exports, __webpack_require__) { + +var isCore = __webpack_require__(205); +var fs = __webpack_require__(133); +var path = __webpack_require__(4); +var caller = __webpack_require__(201); +var nodeModulesPaths = __webpack_require__(202); +var normalizeOptions = __webpack_require__(204); + +var realpathFS = fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; + +var defaultIsFile = function isFile(file) { + try { + var stat = fs.statSync(file); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return stat.isFile() || stat.isFIFO(); +}; + +var defaultIsDir = function isDirectory(dir) { + try { + var stat = fs.statSync(dir); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return stat.isDirectory(); +}; + +var defaultRealpathSync = function realpathSync(x) { + try { + return realpathFS(x); + } catch (realpathErr) { + if (realpathErr.code !== 'ENOENT') { + throw realpathErr; + } + } + return x; +}; + +var maybeRealpathSync = function maybeRealpathSync(realpathSync, x, opts) { + if (opts && opts.preserveSymlinks === false) { + return realpathSync(x); + } + return x; +}; + +var getPackageCandidates = function getPackageCandidates(x, start, opts) { + var dirs = nodeModulesPaths(start, opts, x); + for (var i = 0; i < dirs.length; i++) { + dirs[i] = path.join(dirs[i], x); + } + return dirs; +}; + +module.exports = function resolveSync(x, options) { + if (typeof x !== 'string') { + throw new TypeError('Path must be a string.'); + } + var opts = normalizeOptions(x, options); + + var isFile = opts.isFile || defaultIsFile; + var readFileSync = opts.readFileSync || fs.readFileSync; + var isDirectory = opts.isDirectory || defaultIsDir; + var realpathSync = opts.realpathSync || defaultRealpathSync; + var packageIterator = opts.packageIterator; + + var extensions = opts.extensions || ['.js']; + var basedir = opts.basedir || path.dirname(caller()); + var parent = opts.filename || basedir; + + opts.paths = opts.paths || []; + + // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory + var absoluteStart = maybeRealpathSync(realpathSync, path.resolve(basedir), opts); + + if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { + var res = path.resolve(absoluteStart, x); + if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; + var m = loadAsFileSync(res) || loadAsDirectorySync(res); + if (m) return maybeRealpathSync(realpathSync, m, opts); + } else if (isCore(x)) { + return x; + } else { + var n = loadNodeModulesSync(x, absoluteStart); + if (n) return maybeRealpathSync(realpathSync, n, opts); + } + + var err = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + err.code = 'MODULE_NOT_FOUND'; + throw err; + + function loadAsFileSync(x) { + var pkg = loadpkg(path.dirname(x)); + + if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) { + var rfile = path.relative(pkg.dir, x); + var r = opts.pathFilter(pkg.pkg, x, rfile); + if (r) { + x = path.resolve(pkg.dir, r); // eslint-disable-line no-param-reassign + } + } + + if (isFile(x)) { + return x; + } + + for (var i = 0; i < extensions.length; i++) { + var file = x + extensions[i]; + if (isFile(file)) { + return file; + } + } + } + + function loadpkg(dir) { + if (dir === '' || dir === '/') return; + if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { + return; + } + if ((/[/\\]node_modules[/\\]*$/).test(dir)) return; + + var pkgfile = path.join(maybeRealpathSync(realpathSync, dir, opts), 'package.json'); + + if (!isFile(pkgfile)) { + return loadpkg(path.dirname(dir)); + } + + var body = readFileSync(pkgfile); + + try { + var pkg = JSON.parse(body); + } catch (jsonErr) {} + + if (pkg && opts.packageFilter) { + // v2 will pass pkgfile + pkg = opts.packageFilter(pkg, /*pkgfile,*/ dir); // eslint-disable-line spaced-comment + } + + return { pkg: pkg, dir: dir }; + } + + function loadAsDirectorySync(x) { + var pkgfile = path.join(maybeRealpathSync(realpathSync, x, opts), '/package.json'); + if (isFile(pkgfile)) { + try { + var body = readFileSync(pkgfile, 'UTF8'); + var pkg = JSON.parse(body); + } catch (e) {} + + if (pkg && opts.packageFilter) { + // v2 will pass pkgfile + pkg = opts.packageFilter(pkg, /*pkgfile,*/ x); // eslint-disable-line spaced-comment + } + + if (pkg && pkg.main) { + if (typeof pkg.main !== 'string') { + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); + mainError.code = 'INVALID_PACKAGE_MAIN'; + throw mainError; + } + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + try { + var m = loadAsFileSync(path.resolve(x, pkg.main)); + if (m) return m; + var n = loadAsDirectorySync(path.resolve(x, pkg.main)); + if (n) return n; + } catch (e) {} + } + } + + return loadAsFileSync(path.join(x, '/index')); + } + + function loadNodeModulesSync(x, start) { + var thunk = function () { return getPackageCandidates(x, start, opts); }; + var dirs = packageIterator ? packageIterator(x, start, thunk, opts) : thunk(); + + for (var i = 0; i < dirs.length; i++) { + var dir = dirs[i]; + if (isDirectory(path.dirname(dir))) { + var m = loadAsFileSync(dir); + if (m) return m; + var n = loadAsDirectorySync(dir); + if (n) return n; + } + } + } +}; + + +/***/ }), +/* 209 */ +/***/ (function(module, exports) { + +module.exports = extractDescription + +// Extracts description from contents of a readme file in markdown format +function extractDescription (d) { + if (!d) return; + if (d === "ERROR: No README data found!") return; + // the first block of text before the first heading + // that isn't the first line heading + d = d.trim().split('\n') + for (var s = 0; d[s] && d[s].trim().match(/^(#|$)/); s ++); + var l = d.length + for (var e = s + 1; e < l && d[e].trim(); e ++); + return d.slice(s, e).join(' ').trim() +} + + +/***/ }), +/* 210 */ +/***/ (function(module) { + +module.exports = JSON.parse("{\"topLevel\":{\"dependancies\":\"dependencies\",\"dependecies\":\"dependencies\",\"depdenencies\":\"dependencies\",\"devEependencies\":\"devDependencies\",\"depends\":\"dependencies\",\"dev-dependencies\":\"devDependencies\",\"devDependences\":\"devDependencies\",\"devDepenencies\":\"devDependencies\",\"devdependencies\":\"devDependencies\",\"repostitory\":\"repository\",\"repo\":\"repository\",\"prefereGlobal\":\"preferGlobal\",\"hompage\":\"homepage\",\"hampage\":\"homepage\",\"autohr\":\"author\",\"autor\":\"author\",\"contributers\":\"contributors\",\"publicationConfig\":\"publishConfig\",\"script\":\"scripts\"},\"bugs\":{\"web\":\"url\",\"name\":\"url\"},\"script\":{\"server\":\"start\",\"tests\":\"test\"}}"); + +/***/ }), +/* 211 */ +/***/ (function(module, exports, __webpack_require__) { + +var util = __webpack_require__(111) +var messages = __webpack_require__(212) + +module.exports = function() { + var args = Array.prototype.slice.call(arguments, 0) + var warningName = args.shift() + if (warningName == "typo") { + return makeTypoWarning.apply(null,args) + } + else { + var msgTemplate = messages[warningName] ? messages[warningName] : warningName + ": '%s'" + args.unshift(msgTemplate) + return util.format.apply(null, args) + } } -Parser.prototype = parser;parser.Parser = Parser; -return new Parser; -})(); +function makeTypoWarning (providedName, probableName, field) { + if (field) { + providedName = field + "['" + providedName + "']" + probableName = field + "['" + probableName + "']" + } + return util.format(messages.typo, providedName, probableName) +} + + +/***/ }), +/* 212 */ +/***/ (function(module) { + +module.exports = JSON.parse("{\"repositories\":\"'repositories' (plural) Not supported. Please pick one as the 'repository' field\",\"missingRepository\":\"No repository field.\",\"brokenGitUrl\":\"Probably broken git url: %s\",\"nonObjectScripts\":\"scripts must be an object\",\"nonStringScript\":\"script values must be string commands\",\"nonArrayFiles\":\"Invalid 'files' member\",\"invalidFilename\":\"Invalid filename in 'files' list: %s\",\"nonArrayBundleDependencies\":\"Invalid 'bundleDependencies' list. Must be array of package names\",\"nonStringBundleDependency\":\"Invalid bundleDependencies member: %s\",\"nonDependencyBundleDependency\":\"Non-dependency in bundleDependencies: %s\",\"nonObjectDependencies\":\"%s field must be an object\",\"nonStringDependency\":\"Invalid dependency: %s %s\",\"deprecatedArrayDependencies\":\"specifying %s as array is deprecated\",\"deprecatedModules\":\"modules field is deprecated\",\"nonArrayKeywords\":\"keywords should be an array of strings\",\"nonStringKeyword\":\"keywords should be an array of strings\",\"conflictingName\":\"%s is also the name of a node core module.\",\"nonStringDescription\":\"'description' field should be a string\",\"missingDescription\":\"No description\",\"missingReadme\":\"No README data\",\"missingLicense\":\"No license field.\",\"nonEmailUrlBugsString\":\"Bug string field must be url, email, or {email,url}\",\"nonUrlBugsUrlField\":\"bugs.url field must be a string url. Deleted.\",\"nonEmailBugsEmailField\":\"bugs.email field must be a string email. Deleted.\",\"emptyNormalizedBugs\":\"Normalized value of bugs field is an empty object. Deleted.\",\"nonUrlHomepage\":\"homepage field must be a string url. Deleted.\",\"invalidLicense\":\"license should be a valid SPDX license expression\",\"typo\":\"%s should probably be %s.\"}"); + +/***/ }), +/* 213 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +const path = __webpack_require__(4); +const writeJsonFile = __webpack_require__(214); +const sortKeys = __webpack_require__(228); + +const dependencyKeys = new Set([ + 'dependencies', + 'devDependencies', + 'optionalDependencies', + 'peerDependencies' +]); + +function normalize(packageJson) { + const result = {}; + + for (const key of Object.keys(packageJson)) { + if (!dependencyKeys.has(key)) { + result[key] = packageJson[key]; + } else if (Object.keys(packageJson[key]).length !== 0) { + result[key] = sortKeys(packageJson[key]); + } + } + + return result; +} + +module.exports = async (filePath, data, options) => { + if (typeof filePath !== 'string') { + options = data; + data = filePath; + filePath = '.'; + } + + options = { + normalize: true, + ...options, + detectIndent: true + }; + + filePath = path.basename(filePath) === 'package.json' ? filePath : path.join(filePath, 'package.json'); + + data = options.normalize ? normalize(data) : data; + + return writeJsonFile(filePath, data, options); +}; + +module.exports.sync = (filePath, data, options) => { + if (typeof filePath !== 'string') { + options = data; + data = filePath; + filePath = '.'; + } + + options = { + normalize: true, + ...options, + detectIndent: true + }; + + filePath = path.basename(filePath) === 'package.json' ? filePath : path.join(filePath, 'package.json'); + + data = options.normalize ? normalize(data) : data; + + writeJsonFile.sync(filePath, data, options); +}; + + +/***/ }), +/* 214 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +const path = __webpack_require__(4); +const fs = __webpack_require__(215); +const writeFileAtomic = __webpack_require__(219); +const sortKeys = __webpack_require__(228); +const makeDir = __webpack_require__(230); +const pify = __webpack_require__(231); +const detectIndent = __webpack_require__(232); + +const init = (fn, filePath, data, options) => { + if (!filePath) { + throw new TypeError('Expected a filepath'); + } + + if (data === undefined) { + throw new TypeError('Expected data to stringify'); + } + + options = Object.assign({ + indent: '\t', + sortKeys: false + }, options); + + if (options.sortKeys) { + data = sortKeys(data, { + deep: true, + compare: typeof options.sortKeys === 'function' ? options.sortKeys : undefined + }); + } + + return fn(filePath, data, options); +}; + +const readFile = filePath => pify(fs.readFile)(filePath, 'utf8').catch(() => {}); + +const main = (filePath, data, options) => { + return (options.detectIndent ? readFile(filePath) : Promise.resolve()) + .then(string => { + const indent = string ? detectIndent(string).indent : options.indent; + const json = JSON.stringify(data, options.replacer, indent); + + return pify(writeFileAtomic)(filePath, `${json}\n`, {mode: options.mode}); + }); +}; + +const mainSync = (filePath, data, options) => { + let {indent} = options; + + if (options.detectIndent) { + try { + const file = fs.readFileSync(filePath, 'utf8'); + indent = detectIndent(file).indent; + } catch (error) { + if (error.code !== 'ENOENT') { + throw error; + } + } + } + + const json = JSON.stringify(data, options.replacer, indent); + + return writeFileAtomic.sync(filePath, `${json}\n`, {mode: options.mode}); +}; + +const writeJsonFile = (filePath, data, options) => { + return makeDir(path.dirname(filePath), {fs}) + .then(() => init(main, filePath, data, options)); +}; + +module.exports = writeJsonFile; +// TODO: Remove this for the next major release +module.exports.default = writeJsonFile; +module.exports.sync = (filePath, data, options) => { + makeDir.sync(path.dirname(filePath), {fs}); + init(mainSync, filePath, data, options); +}; + + +/***/ }), +/* 215 */ +/***/ (function(module, exports, __webpack_require__) { + +var fs = __webpack_require__(133) +var polyfills = __webpack_require__(216) +var legacy = __webpack_require__(217) +var clone = __webpack_require__(218) + +var queue = [] + +var util = __webpack_require__(111) + +function noop () {} + +var debug = noop +if (util.debuglog) + debug = util.debuglog('gfs4') +else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) + debug = function() { + var m = util.format.apply(util, arguments) + m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') + console.error(m) + } + +if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { + process.on('exit', function() { + debug(queue) + __webpack_require__(139).equal(queue.length, 0) + }) +} + +module.exports = patch(clone(fs)) +if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { + module.exports = patch(fs) + fs.__patched = true; +} + +// Always patch fs.close/closeSync, because we want to +// retry() whenever a close happens *anywhere* in the program. +// This is essential when multiple graceful-fs instances are +// in play at the same time. +module.exports.close = (function (fs$close) { return function (fd, cb) { + return fs$close.call(fs, fd, function (err) { + if (!err) + retry() + + if (typeof cb === 'function') + cb.apply(this, arguments) + }) +}})(fs.close) + +module.exports.closeSync = (function (fs$closeSync) { return function (fd) { + // Note that graceful-fs also retries when fs.closeSync() fails. + // Looks like a bug to me, although it's probably a harmless one. + var rval = fs$closeSync.apply(fs, arguments) + retry() + return rval +}})(fs.closeSync) + +// Only patch fs once, otherwise we'll run into a memory leak if +// graceful-fs is loaded multiple times, such as in test environments that +// reset the loaded modules between tests. +// We look for the string `graceful-fs` from the comment above. This +// way we are not adding any extra properties and it will detect if older +// versions of graceful-fs are installed. +if (!/\bgraceful-fs\b/.test(fs.closeSync.toString())) { + fs.closeSync = module.exports.closeSync; + fs.close = module.exports.close; +} + +function patch (fs) { + // Everything that references the open() function needs to be in here + polyfills(fs) + fs.gracefulify = patch + fs.FileReadStream = ReadStream; // Legacy name. + fs.FileWriteStream = WriteStream; // Legacy name. + fs.createReadStream = createReadStream + fs.createWriteStream = createWriteStream + var fs$readFile = fs.readFile + fs.readFile = readFile + function readFile (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$readFile(path, options, cb) + + function go$readFile (path, options, cb) { + return fs$readFile(path, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readFile, [path, options, cb]]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() + } + }) + } + } + + var fs$writeFile = fs.writeFile + fs.writeFile = writeFile + function writeFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$writeFile(path, data, options, cb) + + function go$writeFile (path, data, options, cb) { + return fs$writeFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$writeFile, [path, data, options, cb]]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() + } + }) + } + } + + var fs$appendFile = fs.appendFile + if (fs$appendFile) + fs.appendFile = appendFile + function appendFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$appendFile(path, data, options, cb) + + function go$appendFile (path, data, options, cb) { + return fs$appendFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$appendFile, [path, data, options, cb]]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() + } + }) + } + } + + var fs$readdir = fs.readdir + fs.readdir = readdir + function readdir (path, options, cb) { + var args = [path] + if (typeof options !== 'function') { + args.push(options) + } else { + cb = options + } + args.push(go$readdir$cb) + + return go$readdir(args) + + function go$readdir$cb (err, files) { + if (files && files.sort) + files.sort() + + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readdir, [args]]) + + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() + } + } + } + + function go$readdir (args) { + return fs$readdir.apply(fs, args) + } + + if (process.version.substr(0, 4) === 'v0.8') { + var legStreams = legacy(fs) + ReadStream = legStreams.ReadStream + WriteStream = legStreams.WriteStream + } + + var fs$ReadStream = fs.ReadStream + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype) + ReadStream.prototype.open = ReadStream$open + } + + var fs$WriteStream = fs.WriteStream + if (fs$WriteStream) { + WriteStream.prototype = Object.create(fs$WriteStream.prototype) + WriteStream.prototype.open = WriteStream$open + } + + fs.ReadStream = ReadStream + fs.WriteStream = WriteStream + + function ReadStream (path, options) { + if (this instanceof ReadStream) + return fs$ReadStream.apply(this, arguments), this + else + return ReadStream.apply(Object.create(ReadStream.prototype), arguments) + } + + function ReadStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + if (that.autoClose) + that.destroy() + + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + that.read() + } + }) + } + + function WriteStream (path, options) { + if (this instanceof WriteStream) + return fs$WriteStream.apply(this, arguments), this + else + return WriteStream.apply(Object.create(WriteStream.prototype), arguments) + } + + function WriteStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + that.destroy() + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + } + }) + } + + function createReadStream (path, options) { + return new ReadStream(path, options) + } -if (true) { -exports.parser = spdxparse; -exports.Parser = spdxparse.Parser; -exports.parse = function () { return spdxparse.parse.apply(spdxparse, arguments); }; -exports.main = function commonjsMain(args) { - if (!args[1]) { - console.log('Usage: '+args[0]+' FILE'); - process.exit(1); + function createWriteStream (path, options) { + return new WriteStream(path, options) + } + + var fs$open = fs.open + fs.open = open + function open (path, flags, mode, cb) { + if (typeof mode === 'function') + cb = mode, mode = null + + return go$open(path, flags, mode, cb) + + function go$open (path, flags, mode, cb) { + return fs$open(path, flags, mode, function (err, fd) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$open, [path, flags, mode, cb]]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() + } + }) } - var source = __webpack_require__(132).readFileSync(__webpack_require__(4).normalize(args[1]), "utf8"); - return exports.parser.parse(source); -}; -if ( true && __webpack_require__.c[__webpack_require__.s] === module) { - exports.main(process.argv.slice(1)); + } + + return fs +} + +function enqueue (elem) { + debug('ENQUEUE', elem[0].name, elem[1]) + queue.push(elem) } + +function retry () { + var elem = queue.shift() + if (elem) { + debug('RETRY', elem[0].name, elem[1]) + elem[0].apply(null, elem[1]) + } } -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(115)(module))) /***/ }), -/* 186 */ +/* 216 */ /***/ (function(module, exports, __webpack_require__) { -var licenseIDs = __webpack_require__(187); +var constants = __webpack_require__(135) -function valid(string) { - return licenseIDs.indexOf(string) > -1; +var origCwd = process.cwd +var cwd = null + +var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform + +process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process) + return cwd } +try { + process.cwd() +} catch (er) {} -// Common transpositions of license identifier acronyms -var transpositions = [ - ['APGL', 'AGPL'], - ['Gpl', 'GPL'], - ['GLP', 'GPL'], - ['APL', 'Apache'], - ['ISD', 'ISC'], - ['GLP', 'GPL'], - ['IST', 'ISC'], - ['Claude', 'Clause'], - [' or later', '+'], - [' International', ''], - ['GNU', 'GPL'], - ['GUN', 'GPL'], - ['+', ''], - ['GNU GPL', 'GPL'], - ['GNU/GPL', 'GPL'], - ['GNU GLP', 'GPL'], - ['GNU General Public License', 'GPL'], - ['Gnu public license', 'GPL'], - ['GNU Public License', 'GPL'], - ['GNU GENERAL PUBLIC LICENSE', 'GPL'], - ['MTI', 'MIT'], - ['Mozilla Public License', 'MPL'], - ['WTH', 'WTF'], - ['-License', ''] -]; +var chdir = process.chdir +process.chdir = function(d) { + cwd = null + chdir.call(process, d) +} -var TRANSPOSED = 0; -var CORRECT = 1; +module.exports = patch -// Simple corrections to nearly valid identifiers. -var transforms = [ - // e.g. 'mit' - function(argument) { - return argument.toUpperCase(); - }, - // e.g. 'MIT ' - function(argument) { - return argument.trim(); - }, - // e.g. 'M.I.T.' - function(argument) { - return argument.replace(/\./g, ''); - }, - // e.g. 'Apache- 2.0' - function(argument) { - return argument.replace(/\s+/g, ''); - }, - // e.g. 'CC BY 4.0'' - function(argument) { - return argument.replace(/\s+/g, '-'); - }, - // e.g. 'LGPLv2.1' - function(argument) { - return argument.replace('v', '-'); - }, - // e.g. 'Apache 2.0' - function(argument) { - return argument.replace(/,?\s*(\d)/, '-$1'); - }, - // e.g. 'GPL 2' - function(argument) { - return argument.replace(/,?\s*(\d)/, '-$1.0'); - }, - // e.g. 'Apache Version 2.0' - function(argument) { - return argument.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/, '-$2'); - }, - // e.g. 'Apache Version 2' - function(argument) { - return argument.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/, '-$2.0'); - }, - // e.g. 'ZLIB' - function(argument) { - return argument[0].toUpperCase() + argument.slice(1); - }, - // e.g. 'MPL/2.0' - function(argument) { - return argument.replace('/', '-'); - }, - // e.g. 'Apache 2' - function(argument) { - return argument - .replace(/\s*V\s*(\d)/, '-$1') - .replace(/(\d)$/, '$1.0'); - }, - // e.g. 'GPL-2.0-' - function(argument) { - return argument.slice(0, argument.length - 1); - }, - // e.g. 'GPL2' - function(argument) { - return argument.replace(/(\d)$/, '-$1.0'); - }, - // e.g. 'BSD 3' - function(argument) { - return argument.replace(/(-| )?(\d)$/, '-$2-Clause'); - }, - // e.g. 'BSD clause 3' - function(argument) { - return argument.replace(/(-| )clause(-| )(\d)/, '-$3-Clause'); - }, - // e.g. 'BY-NC-4.0' - function(argument) { - return 'CC-' + argument; - }, - // e.g. 'BY-NC' - function(argument) { - return 'CC-' + argument + '-4.0'; - }, - // e.g. 'Attribution-NonCommercial' - function(argument) { - return argument - .replace('Attribution', 'BY') - .replace('NonCommercial', 'NC') - .replace('NoDerivatives', 'ND') - .replace(/ (\d)/, '-$1') - .replace(/ ?International/, ''); - }, - // e.g. 'Attribution-NonCommercial' - function(argument) { - return 'CC-' + - argument - .replace('Attribution', 'BY') - .replace('NonCommercial', 'NC') - .replace('NoDerivatives', 'ND') - .replace(/ (\d)/, '-$1') - .replace(/ ?International/, '') + - '-4.0'; +function patch (fs) { + // (re-)implement some things that are known busted or missing. + + // lchmod, broken prior to 0.6.2 + // back-port the fix here. + if (constants.hasOwnProperty('O_SYMLINK') && + process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs) } -]; -// If all else fails, guess that strings containing certain substrings -// meant to identify certain licenses. -var lastResorts = [ - ['UNLI', 'Unlicense'], - ['WTF', 'WTFPL'], - ['2 CLAUSE', 'BSD-2-Clause'], - ['2-CLAUSE', 'BSD-2-Clause'], - ['3 CLAUSE', 'BSD-3-Clause'], - ['3-CLAUSE', 'BSD-3-Clause'], - ['AFFERO', 'AGPL-3.0'], - ['AGPL', 'AGPL-3.0'], - ['APACHE', 'Apache-2.0'], - ['ARTISTIC', 'Artistic-2.0'], - ['Affero', 'AGPL-3.0'], - ['BEER', 'Beerware'], - ['BOOST', 'BSL-1.0'], - ['BSD', 'BSD-2-Clause'], - ['ECLIPSE', 'EPL-1.0'], - ['FUCK', 'WTFPL'], - ['GNU', 'GPL-3.0'], - ['LGPL', 'LGPL-3.0'], - ['GPL', 'GPL-3.0'], - ['MIT', 'MIT'], - ['MPL', 'MPL-2.0'], - ['X11', 'X11'], - ['ZLIB', 'Zlib'] -]; + // lutimes implementation, or no-op + if (!fs.lutimes) { + patchLutimes(fs) + } -var SUBSTRING = 0; -var IDENTIFIER = 1; + // https://github.com/isaacs/node-graceful-fs/issues/4 + // Chown should not fail on einval or eperm if non-root. + // It should not fail on enosys ever, as this just indicates + // that a fs doesn't support the intended operation. -var validTransformation = function(identifier) { - for (var i = 0; i < transforms.length; i++) { - var transformed = transforms[i](identifier); - if (transformed !== identifier && valid(transformed)) { - return transformed; + fs.chown = chownFix(fs.chown) + fs.fchown = chownFix(fs.fchown) + fs.lchown = chownFix(fs.lchown) + + fs.chmod = chmodFix(fs.chmod) + fs.fchmod = chmodFix(fs.fchmod) + fs.lchmod = chmodFix(fs.lchmod) + + fs.chownSync = chownFixSync(fs.chownSync) + fs.fchownSync = chownFixSync(fs.fchownSync) + fs.lchownSync = chownFixSync(fs.lchownSync) + + fs.chmodSync = chmodFixSync(fs.chmodSync) + fs.fchmodSync = chmodFixSync(fs.fchmodSync) + fs.lchmodSync = chmodFixSync(fs.lchmodSync) + + fs.stat = statFix(fs.stat) + fs.fstat = statFix(fs.fstat) + fs.lstat = statFix(fs.lstat) + + fs.statSync = statFixSync(fs.statSync) + fs.fstatSync = statFixSync(fs.fstatSync) + fs.lstatSync = statFixSync(fs.lstatSync) + + // if lchmod/lchown do not exist, then make them no-ops + if (!fs.lchmod) { + fs.lchmod = function (path, mode, cb) { + if (cb) process.nextTick(cb) } + fs.lchmodSync = function () {} + } + if (!fs.lchown) { + fs.lchown = function (path, uid, gid, cb) { + if (cb) process.nextTick(cb) + } + fs.lchownSync = function () {} } - return null; -}; -var validLastResort = function(identifier) { - var upperCased = identifier.toUpperCase(); - for (var i = 0; i < lastResorts.length; i++) { - var lastResort = lastResorts[i]; - if (upperCased.indexOf(lastResort[SUBSTRING]) > -1) { - return lastResort[IDENTIFIER]; + // on Windows, A/V software can lock the directory, causing this + // to fail with an EACCES or EPERM if the directory contains newly + // created files. Try again on failure, for up to 60 seconds. + + // Set the timeout this long because some Windows Anti-Virus, such as Parity + // bit9, may lock files for up to a minute, causing npm package install + // failures. Also, take care to yield the scheduler. Windows scheduling gives + // CPU to a busy looping process, which can cause the program causing the lock + // contention to be starved of CPU by node, so the contention doesn't resolve. + if (platform === "win32") { + fs.rename = (function (fs$rename) { return function (from, to, cb) { + var start = Date.now() + var backoff = 0; + fs$rename(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM") + && Date.now() - start < 60000) { + setTimeout(function() { + fs.stat(to, function (stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er) + }) + }, backoff) + if (backoff < 100) + backoff += 10; + return; + } + if (cb) cb(er) + }) + }})(fs.rename) + } + + // if read() returns EAGAIN, then just try it again. + fs.read = (function (fs$read) { return function (fd, buffer, offset, length, position, callback_) { + var callback + if (callback_ && typeof callback_ === 'function') { + var eagCounter = 0 + callback = function (er, _, __) { + if (er && er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + callback_.apply(this, arguments) + } + } + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + }})(fs.read) + + fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { + var eagCounter = 0 + while (true) { + try { + return fs$readSync.call(fs, fd, buffer, offset, length, position) + } catch (er) { + if (er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + continue + } + throw er + } + } + }})(fs.readSync) + + function patchLchmod (fs) { + fs.lchmod = function (path, mode, callback) { + fs.open( path + , constants.O_WRONLY | constants.O_SYMLINK + , mode + , function (err, fd) { + if (err) { + if (callback) callback(err) + return + } + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + fs.fchmod(fd, mode, function (err) { + fs.close(fd, function(err2) { + if (callback) callback(err || err2) + }) + }) + }) + } + + fs.lchmodSync = function (path, mode) { + var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + var threw = true + var ret + try { + ret = fs.fchmodSync(fd, mode) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret } } - return null; -}; -var anyCorrection = function(identifier, check) { - for (var i = 0; i < transpositions.length; i++) { - var transposition = transpositions[i]; - var transposed = transposition[TRANSPOSED]; - if (identifier.indexOf(transposed) > -1) { - var corrected = identifier.replace( - transposed, - transposition[CORRECT] - ); - var checked = check(corrected); - if (checked !== null) { - return checked; + function patchLutimes (fs) { + if (constants.hasOwnProperty("O_SYMLINK")) { + fs.lutimes = function (path, at, mt, cb) { + fs.open(path, constants.O_SYMLINK, function (er, fd) { + if (er) { + if (cb) cb(er) + return + } + fs.futimes(fd, at, mt, function (er) { + fs.close(fd, function (er2) { + if (cb) cb(er || er2) + }) + }) + }) + } + + fs.lutimesSync = function (path, at, mt) { + var fd = fs.openSync(path, constants.O_SYMLINK) + var ret + var threw = true + try { + ret = fs.futimesSync(fd, at, mt) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + + } else { + fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } + fs.lutimesSync = function () {} + } + } + + function chmodFix (orig) { + if (!orig) return orig + return function (target, mode, cb) { + return orig.call(fs, target, mode, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } + + function chmodFixSync (orig) { + if (!orig) return orig + return function (target, mode) { + try { + return orig.call(fs, target, mode) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } + + + function chownFix (orig) { + if (!orig) return orig + return function (target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } + + function chownFixSync (orig) { + if (!orig) return orig + return function (target, uid, gid) { + try { + return orig.call(fs, target, uid, gid) + } catch (er) { + if (!chownErOk(er)) throw er } } } - return null; -}; -module.exports = function(identifier) { - identifier = identifier.replace(/\+$/, ''); - if (valid(identifier)) { - return identifier; - } - var transformed = validTransformation(identifier); - if (transformed !== null) { - return transformed; - } - transformed = anyCorrection(identifier, function(argument) { - if (valid(argument)) { - return argument; + + function statFix (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, cb) { + return orig.call(fs, target, function (er, stats) { + if (!stats) return cb.apply(this, arguments) + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + if (cb) cb.apply(this, arguments) + }) + } + } + + function statFixSync (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target) { + var stats = orig.call(fs, target) + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + return stats; } - return validTransformation(argument); - }); - if (transformed !== null) { - return transformed; - } - transformed = validLastResort(identifier); - if (transformed !== null) { - return transformed; - } - transformed = anyCorrection(identifier, validLastResort); - if (transformed !== null) { - return transformed; } - return null; -}; + // ENOSYS means that the fs doesn't support the op. Just ignore + // that, because it doesn't matter. + // + // if there's no getuid, or if getuid() is something other + // than 0, and the error is EINVAL or EPERM, then just ignore + // it. + // + // This specific case is a silent failure in cp, install, tar, + // and most other unix tools that manage permissions. + // + // When running as root, or if other types of errors are + // encountered, then it's strict. + function chownErOk (er) { + if (!er) + return true -/***/ }), -/* 187 */ -/***/ (function(module) { + if (er.code === "ENOSYS") + return true + + var nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true + } + + return false + } +} -module.exports = JSON.parse("[\"Glide\",\"Abstyles\",\"AFL-1.1\",\"AFL-1.2\",\"AFL-2.0\",\"AFL-2.1\",\"AFL-3.0\",\"AMPAS\",\"APL-1.0\",\"Adobe-Glyph\",\"APAFML\",\"Adobe-2006\",\"AGPL-1.0\",\"Afmparse\",\"Aladdin\",\"ADSL\",\"AMDPLPA\",\"ANTLR-PD\",\"Apache-1.0\",\"Apache-1.1\",\"Apache-2.0\",\"AML\",\"APSL-1.0\",\"APSL-1.1\",\"APSL-1.2\",\"APSL-2.0\",\"Artistic-1.0\",\"Artistic-1.0-Perl\",\"Artistic-1.0-cl8\",\"Artistic-2.0\",\"AAL\",\"Bahyph\",\"Barr\",\"Beerware\",\"BitTorrent-1.0\",\"BitTorrent-1.1\",\"BSL-1.0\",\"Borceux\",\"BSD-2-Clause\",\"BSD-2-Clause-FreeBSD\",\"BSD-2-Clause-NetBSD\",\"BSD-3-Clause\",\"BSD-3-Clause-Clear\",\"BSD-4-Clause\",\"BSD-Protection\",\"BSD-Source-Code\",\"BSD-3-Clause-Attribution\",\"0BSD\",\"BSD-4-Clause-UC\",\"bzip2-1.0.5\",\"bzip2-1.0.6\",\"Caldera\",\"CECILL-1.0\",\"CECILL-1.1\",\"CECILL-2.0\",\"CECILL-2.1\",\"CECILL-B\",\"CECILL-C\",\"ClArtistic\",\"MIT-CMU\",\"CNRI-Jython\",\"CNRI-Python\",\"CNRI-Python-GPL-Compatible\",\"CPOL-1.02\",\"CDDL-1.0\",\"CDDL-1.1\",\"CPAL-1.0\",\"CPL-1.0\",\"CATOSL-1.1\",\"Condor-1.1\",\"CC-BY-1.0\",\"CC-BY-2.0\",\"CC-BY-2.5\",\"CC-BY-3.0\",\"CC-BY-4.0\",\"CC-BY-ND-1.0\",\"CC-BY-ND-2.0\",\"CC-BY-ND-2.5\",\"CC-BY-ND-3.0\",\"CC-BY-ND-4.0\",\"CC-BY-NC-1.0\",\"CC-BY-NC-2.0\",\"CC-BY-NC-2.5\",\"CC-BY-NC-3.0\",\"CC-BY-NC-4.0\",\"CC-BY-NC-ND-1.0\",\"CC-BY-NC-ND-2.0\",\"CC-BY-NC-ND-2.5\",\"CC-BY-NC-ND-3.0\",\"CC-BY-NC-ND-4.0\",\"CC-BY-NC-SA-1.0\",\"CC-BY-NC-SA-2.0\",\"CC-BY-NC-SA-2.5\",\"CC-BY-NC-SA-3.0\",\"CC-BY-NC-SA-4.0\",\"CC-BY-SA-1.0\",\"CC-BY-SA-2.0\",\"CC-BY-SA-2.5\",\"CC-BY-SA-3.0\",\"CC-BY-SA-4.0\",\"CC0-1.0\",\"Crossword\",\"CrystalStacker\",\"CUA-OPL-1.0\",\"Cube\",\"curl\",\"D-FSL-1.0\",\"diffmark\",\"WTFPL\",\"DOC\",\"Dotseqn\",\"DSDP\",\"dvipdfm\",\"EPL-1.0\",\"ECL-1.0\",\"ECL-2.0\",\"eGenix\",\"EFL-1.0\",\"EFL-2.0\",\"MIT-advertising\",\"MIT-enna\",\"Entessa\",\"ErlPL-1.1\",\"EUDatagrid\",\"EUPL-1.0\",\"EUPL-1.1\",\"Eurosym\",\"Fair\",\"MIT-feh\",\"Frameworx-1.0\",\"FreeImage\",\"FTL\",\"FSFAP\",\"FSFUL\",\"FSFULLR\",\"Giftware\",\"GL2PS\",\"Glulxe\",\"AGPL-3.0\",\"GFDL-1.1\",\"GFDL-1.2\",\"GFDL-1.3\",\"GPL-1.0\",\"GPL-2.0\",\"GPL-3.0\",\"LGPL-2.1\",\"LGPL-3.0\",\"LGPL-2.0\",\"gnuplot\",\"gSOAP-1.3b\",\"HaskellReport\",\"HPND\",\"IBM-pibs\",\"IPL-1.0\",\"ICU\",\"ImageMagick\",\"iMatix\",\"Imlib2\",\"IJG\",\"Info-ZIP\",\"Intel-ACPI\",\"Intel\",\"Interbase-1.0\",\"IPA\",\"ISC\",\"JasPer-2.0\",\"JSON\",\"LPPL-1.0\",\"LPPL-1.1\",\"LPPL-1.2\",\"LPPL-1.3a\",\"LPPL-1.3c\",\"Latex2e\",\"BSD-3-Clause-LBNL\",\"Leptonica\",\"LGPLLR\",\"Libpng\",\"libtiff\",\"LAL-1.2\",\"LAL-1.3\",\"LiLiQ-P-1.1\",\"LiLiQ-Rplus-1.1\",\"LiLiQ-R-1.1\",\"LPL-1.02\",\"LPL-1.0\",\"MakeIndex\",\"MTLL\",\"MS-PL\",\"MS-RL\",\"MirOS\",\"MITNFA\",\"MIT\",\"Motosoto\",\"MPL-1.0\",\"MPL-1.1\",\"MPL-2.0\",\"MPL-2.0-no-copyleft-exception\",\"mpich2\",\"Multics\",\"Mup\",\"NASA-1.3\",\"Naumen\",\"NBPL-1.0\",\"NetCDF\",\"NGPL\",\"NOSL\",\"NPL-1.0\",\"NPL-1.1\",\"Newsletr\",\"NLPL\",\"Nokia\",\"NPOSL-3.0\",\"NLOD-1.0\",\"Noweb\",\"NRL\",\"NTP\",\"Nunit\",\"OCLC-2.0\",\"ODbL-1.0\",\"PDDL-1.0\",\"OCCT-PL\",\"OGTSL\",\"OLDAP-2.2.2\",\"OLDAP-1.1\",\"OLDAP-1.2\",\"OLDAP-1.3\",\"OLDAP-1.4\",\"OLDAP-2.0\",\"OLDAP-2.0.1\",\"OLDAP-2.1\",\"OLDAP-2.2\",\"OLDAP-2.2.1\",\"OLDAP-2.3\",\"OLDAP-2.4\",\"OLDAP-2.5\",\"OLDAP-2.6\",\"OLDAP-2.7\",\"OLDAP-2.8\",\"OML\",\"OPL-1.0\",\"OSL-1.0\",\"OSL-1.1\",\"OSL-2.0\",\"OSL-2.1\",\"OSL-3.0\",\"OpenSSL\",\"OSET-PL-2.1\",\"PHP-3.0\",\"PHP-3.01\",\"Plexus\",\"PostgreSQL\",\"psfrag\",\"psutils\",\"Python-2.0\",\"QPL-1.0\",\"Qhull\",\"Rdisc\",\"RPSL-1.0\",\"RPL-1.1\",\"RPL-1.5\",\"RHeCos-1.1\",\"RSCPL\",\"RSA-MD\",\"Ruby\",\"SAX-PD\",\"Saxpath\",\"SCEA\",\"SWL\",\"SMPPL\",\"Sendmail\",\"SGI-B-1.0\",\"SGI-B-1.1\",\"SGI-B-2.0\",\"OFL-1.0\",\"OFL-1.1\",\"SimPL-2.0\",\"Sleepycat\",\"SNIA\",\"Spencer-86\",\"Spencer-94\",\"Spencer-99\",\"SMLNJ\",\"SugarCRM-1.1.3\",\"SISSL\",\"SISSL-1.2\",\"SPL-1.0\",\"Watcom-1.0\",\"TCL\",\"Unlicense\",\"TMate\",\"TORQUE-1.1\",\"TOSL\",\"Unicode-TOU\",\"UPL-1.0\",\"NCSA\",\"Vim\",\"VOSTROM\",\"VSL-1.0\",\"W3C-19980720\",\"W3C\",\"Wsuipa\",\"Xnet\",\"X11\",\"Xerox\",\"XFree86-1.1\",\"xinetd\",\"xpp\",\"XSkat\",\"YPL-1.0\",\"YPL-1.1\",\"Zed\",\"Zend-2.0\",\"Zimbra-1.3\",\"Zimbra-1.4\",\"Zlib\",\"zlib-acknowledgement\",\"ZPL-1.1\",\"ZPL-2.0\",\"ZPL-2.1\",\"BSD-3-Clause-No-Nuclear-License\",\"BSD-3-Clause-No-Nuclear-Warranty\",\"BSD-3-Clause-No-Nuclear-License-2014\",\"eCos-2.0\",\"GPL-2.0-with-autoconf-exception\",\"GPL-2.0-with-bison-exception\",\"GPL-2.0-with-classpath-exception\",\"GPL-2.0-with-font-exception\",\"GPL-2.0-with-GCC-exception\",\"GPL-3.0-with-autoconf-exception\",\"GPL-3.0-with-GCC-exception\",\"StandardML-NJ\",\"WXwindows\"]"); /***/ }), -/* 188 */ +/* 217 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +var Stream = __webpack_require__(137).Stream -var url = __webpack_require__(189) -var gitHosts = __webpack_require__(190) -var GitHost = module.exports = __webpack_require__(191) +module.exports = legacy -var protocolToRepresentationMap = { - 'git+ssh': 'sshurl', - 'git+https': 'https', - 'ssh': 'sshurl', - 'git': 'git' -} +function legacy (fs) { + return { + ReadStream: ReadStream, + WriteStream: WriteStream + } -function protocolToRepresentation (protocol) { - if (protocol.substr(-1) === ':') protocol = protocol.slice(0, -1) - return protocolToRepresentationMap[protocol] || protocol -} + function ReadStream (path, options) { + if (!(this instanceof ReadStream)) return new ReadStream(path, options); -var authProtocols = { - 'git:': true, - 'https:': true, - 'git+https:': true, - 'http:': true, - 'git+http:': true -} + Stream.call(this); -var cache = {} + var self = this; -module.exports.fromUrl = function (giturl, opts) { - var key = giturl + JSON.stringify(opts || {}) + this.path = path; + this.fd = null; + this.readable = true; + this.paused = false; - if (!(key in cache)) { - cache[key] = fromUrl(giturl, opts) - } + this.flags = 'r'; + this.mode = 438; /*=0666*/ + this.bufferSize = 64 * 1024; - return cache[key] -} + options = options || {}; -function fromUrl (giturl, opts) { - if (giturl == null || giturl === '') return - var url = fixupUnqualifiedGist( - isGitHubShorthand(giturl) ? 'github:' + giturl : giturl - ) - var parsed = parseGitUrl(url) - var shortcutMatch = url.match(new RegExp('^([^:]+):(?:(?:[^@:]+(?:[^@]+)?@)?([^/]*))[/](.+?)(?:[.]git)?($|#)')) - var matches = Object.keys(gitHosts).map(function (gitHostName) { - try { - var gitHostInfo = gitHosts[gitHostName] - var auth = null - if (parsed.auth && authProtocols[parsed.protocol]) { - auth = decodeURIComponent(parsed.auth) + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.encoding) this.setEncoding(this.encoding); + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); } - var committish = parsed.hash ? decodeURIComponent(parsed.hash.substr(1)) : null - var user = null - var project = null - var defaultRepresentation = null - if (shortcutMatch && shortcutMatch[1] === gitHostName) { - user = shortcutMatch[2] && decodeURIComponent(shortcutMatch[2]) - project = decodeURIComponent(shortcutMatch[3]) - defaultRepresentation = 'shortcut' - } else { - if (parsed.host !== gitHostInfo.domain) return - if (!gitHostInfo.protocols_re.test(parsed.protocol)) return - if (!parsed.path) return - var pathmatch = gitHostInfo.pathmatch - var matched = parsed.path.match(pathmatch) - if (!matched) return - if (matched[1] != null) user = decodeURIComponent(matched[1].replace(/^:/, '')) - if (matched[2] != null) project = decodeURIComponent(matched[2]) - defaultRepresentation = protocolToRepresentation(parsed.protocol) + if (this.end === undefined) { + this.end = Infinity; + } else if ('number' !== typeof this.end) { + throw TypeError('end must be a Number'); } - return new GitHost(gitHostName, user, auth, project, committish, defaultRepresentation, opts) - } catch (ex) { - if (!(ex instanceof URIError)) throw ex + + if (this.start > this.end) { + throw new Error('start must be <= end'); + } + + this.pos = this.start; } - }).filter(function (gitHostInfo) { return gitHostInfo }) - if (matches.length !== 1) return - return matches[0] -} -function isGitHubShorthand (arg) { - // Note: This does not fully test the git ref format. - // See https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html - // - // The only way to do this properly would be to shell out to - // git-check-ref-format, and as this is a fast sync function, - // we don't want to do that. Just let git fail if it turns - // out that the commit-ish is invalid. - // GH usernames cannot start with . or - - return /^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(arg) -} + if (this.fd !== null) { + process.nextTick(function() { + self._read(); + }); + return; + } -function fixupUnqualifiedGist (giturl) { - // necessary for round-tripping gists - var parsed = url.parse(giturl) - if (parsed.protocol === 'gist:' && parsed.host && !parsed.path) { - return parsed.protocol + '/' + parsed.host - } else { - return giturl + fs.open(this.path, this.flags, this.mode, function (err, fd) { + if (err) { + self.emit('error', err); + self.readable = false; + return; + } + + self.fd = fd; + self.emit('open', fd); + self._read(); + }) } -} -function parseGitUrl (giturl) { - if (typeof giturl !== 'string') giturl = '' + giturl - var matched = giturl.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/) - if (!matched) return url.parse(giturl) - return { - protocol: 'git+ssh:', - slashes: true, - auth: matched[1], - host: matched[2], - port: null, - hostname: matched[2], - hash: matched[4], - search: null, - query: null, - pathname: '/' + matched[3], - path: '/' + matched[3], - href: 'git+ssh://' + matched[1] + '@' + matched[2] + - '/' + matched[3] + (matched[4] || '') + function WriteStream (path, options) { + if (!(this instanceof WriteStream)) return new WriteStream(path, options); + + Stream.call(this); + + this.path = path; + this.fd = null; + this.writable = true; + + this.flags = 'w'; + this.encoding = 'binary'; + this.mode = 438; /*=0666*/ + this.bytesWritten = 0; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.start < 0) { + throw new Error('start must be >= zero'); + } + + this.pos = this.start; + } + + this.busy = false; + this._queue = []; + + if (this.fd === null) { + this._open = fs.open; + this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); + this.flush(); + } } } /***/ }), -/* 189 */ -/***/ (function(module, exports) { +/* 218 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = clone + +function clone (obj) { + if (obj === null || typeof obj !== 'object') + return obj + + if (obj instanceof Object) + var copy = { __proto__: obj.__proto__ } + else + var copy = Object.create(null) + + Object.getOwnPropertyNames(obj).forEach(function (key) { + Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) + }) + + return copy +} -module.exports = require("url"); /***/ }), -/* 190 */ +/* 219 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +module.exports = writeFile +module.exports.sync = writeFileSync +module.exports._getTmpname = getTmpname // for testing +module.exports._cleanupOnExit = cleanupOnExit -var gitHosts = module.exports = { - github: { - // First two are insecure and generally shouldn't be used any more, but - // they are still supported. - 'protocols': [ 'git', 'http', 'git+ssh', 'git+https', 'ssh', 'https' ], - 'domain': 'github.com', - 'treepath': 'tree', - 'filetemplate': 'https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}', - 'bugstemplate': 'https://{domain}/{user}/{project}/issues', - 'gittemplate': 'git://{auth@}{domain}/{user}/{project}.git{#committish}', - 'tarballtemplate': 'https://{domain}/{user}/{project}/archive/{committish}.tar.gz' - }, - bitbucket: { - 'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ], - 'domain': 'bitbucket.org', - 'treepath': 'src', - 'tarballtemplate': 'https://{domain}/{user}/{project}/get/{committish}.tar.gz' - }, - gitlab: { - 'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ], - 'domain': 'gitlab.com', - 'treepath': 'tree', - 'docstemplate': 'https://{domain}/{user}/{project}{/tree/committish}#README', - 'bugstemplate': 'https://{domain}/{user}/{project}/issues', - 'tarballtemplate': 'https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}' - }, - gist: { - 'protocols': [ 'git', 'git+ssh', 'git+https', 'ssh', 'https' ], - 'domain': 'gist.github.com', - 'pathmatch': /^[/](?:([^/]+)[/])?([a-z0-9]+)(?:[.]git)?$/, - 'filetemplate': 'https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}', - 'bugstemplate': 'https://{domain}/{project}', - 'gittemplate': 'git://{domain}/{project}.git{#committish}', - 'sshtemplate': 'git@{domain}:/{project}.git{#committish}', - 'sshurltemplate': 'git+ssh://git@{domain}/{project}.git{#committish}', - 'browsetemplate': 'https://{domain}/{project}{/committish}', - 'docstemplate': 'https://{domain}/{project}{/committish}', - 'httpstemplate': 'git+https://{domain}/{project}.git{#committish}', - 'shortcuttemplate': '{type}:{project}{#committish}', - 'pathtemplate': '{project}{#committish}', - 'tarballtemplate': 'https://{domain}/{user}/{project}/archive/{committish}.tar.gz' +var fs = __webpack_require__(220) +var MurmurHash3 = __webpack_require__(224) +var onExit = __webpack_require__(225) +var path = __webpack_require__(4) +var activeFiles = {} + +// if we run inside of a worker_thread, `process.pid` is not unique +/* istanbul ignore next */ +var threadId = (function getId () { + try { + var workerThreads = __webpack_require__(227) + + /// if we are in main thread, this is set to `0` + return workerThreads.threadId + } catch (e) { + // worker_threads are not available, fallback to 0 + return 0 } -} +})() -var gitHostDefaults = { - 'sshtemplate': 'git@{domain}:{user}/{project}.git{#committish}', - 'sshurltemplate': 'git+ssh://git@{domain}/{user}/{project}.git{#committish}', - 'browsetemplate': 'https://{domain}/{user}/{project}{/tree/committish}', - 'docstemplate': 'https://{domain}/{user}/{project}{/tree/committish}#readme', - 'httpstemplate': 'git+https://{auth@}{domain}/{user}/{project}.git{#committish}', - 'filetemplate': 'https://{domain}/{user}/{project}/raw/{committish}/{path}', - 'shortcuttemplate': '{type}:{user}/{project}{#committish}', - 'pathtemplate': '{user}/{project}{#committish}', - 'pathmatch': /^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/ +var invocations = 0 +function getTmpname (filename) { + return filename + '.' + + MurmurHash3(__filename) + .hash(String(process.pid)) + .hash(String(threadId)) + .hash(String(++invocations)) + .result() } -Object.keys(gitHosts).forEach(function (name) { - Object.keys(gitHostDefaults).forEach(function (key) { - if (gitHosts[name][key]) return - gitHosts[name][key] = gitHostDefaults[key] - }) - gitHosts[name].protocols_re = RegExp('^(' + - gitHosts[name].protocols.map(function (protocol) { - return protocol.replace(/([\\+*{}()[\]$^|])/g, '\\$1') - }).join('|') + '):$') -}) +function cleanupOnExit (tmpfile) { + return function () { + try { + fs.unlinkSync(typeof tmpfile === 'function' ? tmpfile() : tmpfile) + } catch (_) {} + } +} +function writeFile (filename, data, options, callback) { + if (options) { + if (options instanceof Function) { + callback = options + options = {} + } else if (typeof options === 'string') { + options = { encoding: options } + } + } else { + options = {} + } -/***/ }), -/* 191 */ -/***/ (function(module, exports, __webpack_require__) { + var Promise = options.Promise || global.Promise + var truename + var fd + var tmpfile + /* istanbul ignore next -- The closure only gets called when onExit triggers */ + var removeOnExitHandler = onExit(cleanupOnExit(() => tmpfile)) + var absoluteName = path.resolve(filename) -"use strict"; + new Promise(function serializeSameFile (resolve) { + // make a queue if it doesn't already exist + if (!activeFiles[absoluteName]) activeFiles[absoluteName] = [] -var gitHosts = __webpack_require__(190) -var extend = Object.assign || __webpack_require__(111)._extend + activeFiles[absoluteName].push(resolve) // add this job to the queue + if (activeFiles[absoluteName].length === 1) resolve() // kick off the first one + }).then(function getRealPath () { + return new Promise(function (resolve) { + fs.realpath(filename, function (_, realname) { + truename = realname || filename + tmpfile = getTmpname(truename) + resolve() + }) + }) + }).then(function stat () { + return new Promise(function stat (resolve) { + if (options.mode && options.chown) resolve() + else { + // Either mode or chown is not explicitly set + // Default behavior is to copy it from original file + fs.stat(truename, function (err, stats) { + if (err || !stats) resolve() + else { + options = Object.assign({}, options) -var GitHost = module.exports = function (type, user, auth, project, committish, defaultRepresentation, opts) { - var gitHostInfo = this - gitHostInfo.type = type - Object.keys(gitHosts[type]).forEach(function (key) { - gitHostInfo[key] = gitHosts[type][key] + if (options.mode == null) { + options.mode = stats.mode + } + if (options.chown == null && process.getuid) { + options.chown = { uid: stats.uid, gid: stats.gid } + } + resolve() + } + }) + } + }) + }).then(function thenWriteFile () { + return new Promise(function (resolve, reject) { + fs.open(tmpfile, 'w', options.mode, function (err, _fd) { + fd = _fd + if (err) reject(err) + else resolve() + }) + }) + }).then(function write () { + return new Promise(function (resolve, reject) { + if (Buffer.isBuffer(data)) { + fs.write(fd, data, 0, data.length, 0, function (err) { + if (err) reject(err) + else resolve() + }) + } else if (data != null) { + fs.write(fd, String(data), 0, String(options.encoding || 'utf8'), function (err) { + if (err) reject(err) + else resolve() + }) + } else resolve() + }) + }).then(function syncAndClose () { + return new Promise(function (resolve, reject) { + if (options.fsync !== false) { + fs.fsync(fd, function (err) { + if (err) fs.close(fd, () => reject(err)) + else fs.close(fd, resolve) + }) + } else { + fs.close(fd, resolve) + } + }) + }).then(function chown () { + fd = null + if (options.chown) { + return new Promise(function (resolve, reject) { + fs.chown(tmpfile, options.chown.uid, options.chown.gid, function (err) { + if (err) reject(err) + else resolve() + }) + }) + } + }).then(function chmod () { + if (options.mode) { + return new Promise(function (resolve, reject) { + fs.chmod(tmpfile, options.mode, function (err) { + if (err) reject(err) + else resolve() + }) + }) + } + }).then(function rename () { + return new Promise(function (resolve, reject) { + fs.rename(tmpfile, truename, function (err) { + if (err) reject(err) + else resolve() + }) + }) + }).then(function success () { + removeOnExitHandler() + callback() + }, function fail (err) { + return new Promise(resolve => { + return fd ? fs.close(fd, resolve) : resolve() + }).then(() => { + removeOnExitHandler() + fs.unlink(tmpfile, function () { + callback(err) + }) + }) + }).then(function checkQueue () { + activeFiles[absoluteName].shift() // remove the element added by serializeSameFile + if (activeFiles[absoluteName].length > 0) { + activeFiles[absoluteName][0]() // start next job if one is pending + } else delete activeFiles[absoluteName] }) - gitHostInfo.user = user - gitHostInfo.auth = auth - gitHostInfo.project = project - gitHostInfo.committish = committish - gitHostInfo.default = defaultRepresentation - gitHostInfo.opts = opts || {} -} -GitHost.prototype = {} - -GitHost.prototype.hash = function () { - return this.committish ? '#' + this.committish : '' } -GitHost.prototype._fill = function (template, opts) { - if (!template) return - var vars = extend({}, opts) - opts = extend(extend({}, this.opts), opts) - var self = this - Object.keys(this).forEach(function (key) { - if (self[key] != null && vars[key] == null) vars[key] = self[key] - }) - var rawAuth = vars.auth - var rawComittish = vars.committish - Object.keys(vars).forEach(function (key) { - vars[key] = encodeURIComponent(vars[key]) - }) - vars['auth@'] = rawAuth ? rawAuth + '@' : '' - if (opts.noCommittish) { - vars['#committish'] = '' - vars['/tree/committish'] = '' - vars['/comittish'] = '' - vars.comittish = '' - } else { - vars['#committish'] = rawComittish ? '#' + rawComittish : '' - vars['/tree/committish'] = vars.committish - ? '/' + vars.treepath + '/' + vars.committish - : '' - vars['/committish'] = vars.committish ? '/' + vars.committish : '' - vars.committish = vars.committish || 'master' - } - var res = template - Object.keys(vars).forEach(function (key) { - res = res.replace(new RegExp('[{]' + key + '[}]', 'g'), vars[key]) - }) - if (opts.noGitPlus) { - return res.replace(/^git[+]/, '') - } else { - return res +function writeFileSync (filename, data, options) { + if (typeof options === 'string') options = { encoding: options } + else if (!options) options = {} + try { + filename = fs.realpathSync(filename) + } catch (ex) { + // it's ok, it'll happen on a not yet existing file } -} - -GitHost.prototype.ssh = function (opts) { - return this._fill(this.sshtemplate, opts) -} - -GitHost.prototype.sshurl = function (opts) { - return this._fill(this.sshurltemplate, opts) -} + var tmpfile = getTmpname(filename) -GitHost.prototype.browse = function (opts) { - return this._fill(this.browsetemplate, opts) -} + if (!options.mode || !options.chown) { + // Either mode or chown is not explicitly set + // Default behavior is to copy it from original file + try { + var stats = fs.statSync(filename) + options = Object.assign({}, options) + if (!options.mode) { + options.mode = stats.mode + } + if (!options.chown && process.getuid) { + options.chown = { uid: stats.uid, gid: stats.gid } + } + } catch (ex) { + // ignore stat errors + } + } -GitHost.prototype.docs = function (opts) { - return this._fill(this.docstemplate, opts) -} + var fd + var cleanup = cleanupOnExit(tmpfile) + var removeOnExitHandler = onExit(cleanup) -GitHost.prototype.bugs = function (opts) { - return this._fill(this.bugstemplate, opts) + try { + fd = fs.openSync(tmpfile, 'w', options.mode) + if (Buffer.isBuffer(data)) { + fs.writeSync(fd, data, 0, data.length, 0) + } else if (data != null) { + fs.writeSync(fd, String(data), 0, String(options.encoding || 'utf8')) + } + if (options.fsync !== false) { + fs.fsyncSync(fd) + } + fs.closeSync(fd) + if (options.chown) fs.chownSync(tmpfile, options.chown.uid, options.chown.gid) + if (options.mode) fs.chmodSync(tmpfile, options.mode) + fs.renameSync(tmpfile, filename) + removeOnExitHandler() + } catch (err) { + if (fd) { + try { + fs.closeSync(fd) + } catch (ex) { + // ignore close errors at this stage, error may have closed fd already. + } + } + removeOnExitHandler() + cleanup() + throw err + } } -GitHost.prototype.https = function (opts) { - return this._fill(this.httpstemplate, opts) -} -GitHost.prototype.git = function (opts) { - return this._fill(this.gittemplate, opts) -} +/***/ }), +/* 220 */ +/***/ (function(module, exports, __webpack_require__) { -GitHost.prototype.shortcut = function (opts) { - return this._fill(this.shortcuttemplate, opts) -} +var fs = __webpack_require__(133) +var polyfills = __webpack_require__(221) +var legacy = __webpack_require__(223) +var queue = [] -GitHost.prototype.path = function (opts) { - return this._fill(this.pathtemplate, opts) -} +var util = __webpack_require__(111) -GitHost.prototype.tarball = function (opts) { - return this._fill(this.tarballtemplate, opts) -} +function noop () {} -GitHost.prototype.file = function (P, opts) { - return this._fill(this.filetemplate, extend({ - path: P.replace(/^[/]+/g, '') - }, opts)) -} +var debug = noop +if (util.debuglog) + debug = util.debuglog('gfs4') +else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) + debug = function() { + var m = util.format.apply(util, arguments) + m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') + console.error(m) + } -GitHost.prototype.getDefaultRepresentation = function () { - return this.default +if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { + process.on('exit', function() { + debug(queue) + __webpack_require__(139).equal(queue.length, 0) + }) } -GitHost.prototype.toString = function (opts) { - return (this[this.default] || this.sshurl).call(this, opts) +module.exports = patch(__webpack_require__(222)) +if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH) { + module.exports = patch(fs) } +// Always patch fs.close/closeSync, because we want to +// retry() whenever a close happens *anywhere* in the program. +// This is essential when multiple graceful-fs instances are +// in play at the same time. +module.exports.close = +fs.close = (function (fs$close) { return function (fd, cb) { + return fs$close.call(fs, fd, function (err) { + if (!err) + retry() -/***/ }), -/* 192 */ -/***/ (function(module, exports, __webpack_require__) { - -var async = __webpack_require__(193); -async.core = __webpack_require__(199); -async.isCore = __webpack_require__(198); -async.sync = __webpack_require__(201); + if (typeof cb === 'function') + cb.apply(this, arguments) + }) +}})(fs.close) -module.exports = async; +module.exports.closeSync = +fs.closeSync = (function (fs$closeSync) { return function (fd) { + // Note that graceful-fs also retries when fs.closeSync() fails. + // Looks like a bug to me, although it's probably a harmless one. + var rval = fs$closeSync.apply(fs, arguments) + retry() + return rval +}})(fs.closeSync) +function patch (fs) { + // Everything that references the open() function needs to be in here + polyfills(fs) + fs.gracefulify = patch + fs.FileReadStream = ReadStream; // Legacy name. + fs.FileWriteStream = WriteStream; // Legacy name. + fs.createReadStream = createReadStream + fs.createWriteStream = createWriteStream + var fs$readFile = fs.readFile + fs.readFile = readFile + function readFile (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null -/***/ }), -/* 193 */ -/***/ (function(module, exports, __webpack_require__) { + return go$readFile(path, options, cb) -var fs = __webpack_require__(132); -var path = __webpack_require__(4); -var caller = __webpack_require__(194); -var nodeModulesPaths = __webpack_require__(195); -var normalizeOptions = __webpack_require__(197); -var isCore = __webpack_require__(198); + function go$readFile (path, options, cb) { + return fs$readFile(path, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readFile, [path, options, cb]]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() + } + }) + } + } -var realpathFS = fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; + var fs$writeFile = fs.writeFile + fs.writeFile = writeFile + function writeFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null -var defaultIsFile = function isFile(file, cb) { - fs.stat(file, function (err, stat) { - if (!err) { - return cb(null, stat.isFile() || stat.isFIFO()); - } - if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); - return cb(err); - }); -}; + return go$writeFile(path, data, options, cb) -var defaultIsDir = function isDirectory(dir, cb) { - fs.stat(dir, function (err, stat) { - if (!err) { - return cb(null, stat.isDirectory()); + function go$writeFile (path, data, options, cb) { + return fs$writeFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$writeFile, [path, data, options, cb]]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() } - if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); - return cb(err); - }); -}; + }) + } + } -var defaultRealpath = function realpath(x, cb) { - realpathFS(x, function (realpathErr, realPath) { - if (realpathErr && realpathErr.code !== 'ENOENT') cb(realpathErr); - else cb(null, realpathErr ? x : realPath); - }); -}; + var fs$appendFile = fs.appendFile + if (fs$appendFile) + fs.appendFile = appendFile + function appendFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null -var maybeRealpath = function maybeRealpath(realpath, x, opts, cb) { - if (opts && opts.preserveSymlinks === false) { - realpath(x, cb); - } else { - cb(null, x); - } -}; + return go$appendFile(path, data, options, cb) -var getPackageCandidates = function getPackageCandidates(x, start, opts) { - var dirs = nodeModulesPaths(start, opts, x); - for (var i = 0; i < dirs.length; i++) { - dirs[i] = path.join(dirs[i], x); + function go$appendFile (path, data, options, cb) { + return fs$appendFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$appendFile, [path, data, options, cb]]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() + } + }) } - return dirs; -}; + } -module.exports = function resolve(x, options, callback) { - var cb = callback; - var opts = options; - if (typeof options === 'function') { - cb = opts; - opts = {}; - } - if (typeof x !== 'string') { - var err = new TypeError('Path must be a string.'); - return process.nextTick(function () { - cb(err); - }); + var fs$readdir = fs.readdir + fs.readdir = readdir + function readdir (path, options, cb) { + var args = [path] + if (typeof options !== 'function') { + args.push(options) + } else { + cb = options } + args.push(go$readdir$cb) - opts = normalizeOptions(x, opts); + return go$readdir(args) - var isFile = opts.isFile || defaultIsFile; - var isDirectory = opts.isDirectory || defaultIsDir; - var readFile = opts.readFile || fs.readFile; - var realpath = opts.realpath || defaultRealpath; - var packageIterator = opts.packageIterator; + function go$readdir$cb (err, files) { + if (files && files.sort) + files.sort() - var extensions = opts.extensions || ['.js']; - var basedir = opts.basedir || path.dirname(caller()); - var parent = opts.filename || basedir; + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readdir, [args]]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() + } + } + } - opts.paths = opts.paths || []; + function go$readdir (args) { + return fs$readdir.apply(fs, args) + } - // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory - var absoluteStart = path.resolve(basedir); + if (process.version.substr(0, 4) === 'v0.8') { + var legStreams = legacy(fs) + ReadStream = legStreams.ReadStream + WriteStream = legStreams.WriteStream + } - maybeRealpath( - realpath, - absoluteStart, - opts, - function (err, realStart) { - if (err) cb(err); - else init(realStart); - } - ); + var fs$ReadStream = fs.ReadStream + ReadStream.prototype = Object.create(fs$ReadStream.prototype) + ReadStream.prototype.open = ReadStream$open - var res; - function init(basedir) { - if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { - res = path.resolve(basedir, x); - if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; - if ((/\/$/).test(x) && res === basedir) { - loadAsDirectory(res, opts.package, onfile); - } else loadAsFile(res, opts.package, onfile); - } else if (isCore(x)) { - return cb(null, x); - } else loadNodeModules(x, basedir, function (err, n, pkg) { - if (err) cb(err); - else if (n) { - return maybeRealpath(realpath, n, opts, function (err, realN) { - if (err) { - cb(err); - } else { - cb(null, realN, pkg); - } - }); - } else { - var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); - moduleError.code = 'MODULE_NOT_FOUND'; - cb(moduleError); - } - }); - } + var fs$WriteStream = fs.WriteStream + WriteStream.prototype = Object.create(fs$WriteStream.prototype) + WriteStream.prototype.open = WriteStream$open - function onfile(err, m, pkg) { - if (err) cb(err); - else if (m) cb(null, m, pkg); - else loadAsDirectory(res, function (err, d, pkg) { - if (err) cb(err); - else if (d) { - maybeRealpath(realpath, d, opts, function (err, realD) { - if (err) { - cb(err); - } else { - cb(null, realD, pkg); - } - }); - } else { - var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); - moduleError.code = 'MODULE_NOT_FOUND'; - cb(moduleError); - } - }); - } + fs.ReadStream = ReadStream + fs.WriteStream = WriteStream - function loadAsFile(x, thePackage, callback) { - var loadAsFilePackage = thePackage; - var cb = callback; - if (typeof loadAsFilePackage === 'function') { - cb = loadAsFilePackage; - loadAsFilePackage = undefined; - } + function ReadStream (path, options) { + if (this instanceof ReadStream) + return fs$ReadStream.apply(this, arguments), this + else + return ReadStream.apply(Object.create(ReadStream.prototype), arguments) + } - var exts = [''].concat(extensions); - load(exts, x, loadAsFilePackage); + function ReadStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + if (that.autoClose) + that.destroy() - function load(exts, x, loadPackage) { - if (exts.length === 0) return cb(null, undefined, loadPackage); - var file = x + exts[0]; + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + that.read() + } + }) + } - var pkg = loadPackage; - if (pkg) onpkg(null, pkg); - else loadpkg(path.dirname(file), onpkg); + function WriteStream (path, options) { + if (this instanceof WriteStream) + return fs$WriteStream.apply(this, arguments), this + else + return WriteStream.apply(Object.create(WriteStream.prototype), arguments) + } - function onpkg(err, pkg_, dir) { - pkg = pkg_; - if (err) return cb(err); - if (dir && pkg && opts.pathFilter) { - var rfile = path.relative(dir, file); - var rel = rfile.slice(0, rfile.length - exts[0].length); - var r = opts.pathFilter(pkg, x, rel); - if (r) return load( - [''].concat(extensions.slice()), - path.resolve(dir, r), - pkg - ); - } - isFile(file, onex); - } - function onex(err, ex) { - if (err) return cb(err); - if (ex) return cb(null, file, pkg); - load(exts.slice(1), x, pkg); - } - } - } + function WriteStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + that.destroy() + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + } + }) + } - function loadpkg(dir, cb) { - if (dir === '' || dir === '/') return cb(null); - if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { - return cb(null); - } - if ((/[/\\]node_modules[/\\]*$/).test(dir)) return cb(null); + function createReadStream (path, options) { + return new ReadStream(path, options) + } - maybeRealpath(realpath, dir, opts, function (unwrapErr, pkgdir) { - if (unwrapErr) return loadpkg(path.dirname(dir), cb); - var pkgfile = path.join(pkgdir, 'package.json'); - isFile(pkgfile, function (err, ex) { - // on err, ex is false - if (!ex) return loadpkg(path.dirname(dir), cb); + function createWriteStream (path, options) { + return new WriteStream(path, options) + } - readFile(pkgfile, function (err, body) { - if (err) cb(err); - try { var pkg = JSON.parse(body); } catch (jsonErr) {} + var fs$open = fs.open + fs.open = open + function open (path, flags, mode, cb) { + if (typeof mode === 'function') + cb = mode, mode = null - if (pkg && opts.packageFilter) { - pkg = opts.packageFilter(pkg, pkgfile); - } - cb(null, pkg, dir); - }); - }); - }); - } + return go$open(path, flags, mode, cb) - function loadAsDirectory(x, loadAsDirectoryPackage, callback) { - var cb = callback; - var fpkg = loadAsDirectoryPackage; - if (typeof fpkg === 'function') { - cb = fpkg; - fpkg = opts.package; + function go$open (path, flags, mode, cb) { + return fs$open(path, flags, mode, function (err, fd) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$open, [path, flags, mode, cb]]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + retry() } + }) + } + } - maybeRealpath(realpath, x, opts, function (unwrapErr, pkgdir) { - if (unwrapErr) return cb(unwrapErr); - var pkgfile = path.join(pkgdir, 'package.json'); - isFile(pkgfile, function (err, ex) { - if (err) return cb(err); - if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb); + return fs +} - readFile(pkgfile, function (err, body) { - if (err) return cb(err); - try { - var pkg = JSON.parse(body); - } catch (jsonErr) {} +function enqueue (elem) { + debug('ENQUEUE', elem[0].name, elem[1]) + queue.push(elem) +} - if (pkg && opts.packageFilter) { - pkg = opts.packageFilter(pkg, pkgfile); - } +function retry () { + var elem = queue.shift() + if (elem) { + debug('RETRY', elem[0].name, elem[1]) + elem[0].apply(null, elem[1]) + } +} - if (pkg && pkg.main) { - if (typeof pkg.main !== 'string') { - var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); - mainError.code = 'INVALID_PACKAGE_MAIN'; - return cb(mainError); - } - if (pkg.main === '.' || pkg.main === './') { - pkg.main = 'index'; - } - loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) { - if (err) return cb(err); - if (m) return cb(null, m, pkg); - if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb); - var dir = path.resolve(x, pkg.main); - loadAsDirectory(dir, pkg, function (err, n, pkg) { - if (err) return cb(err); - if (n) return cb(null, n, pkg); - loadAsFile(path.join(x, 'index'), pkg, cb); - }); - }); - return; - } +/***/ }), +/* 221 */ +/***/ (function(module, exports, __webpack_require__) { - loadAsFile(path.join(x, '/index'), pkg, cb); - }); - }); - }); - } +var fs = __webpack_require__(222) +var constants = __webpack_require__(135) - function processDirs(cb, dirs) { - if (dirs.length === 0) return cb(null, undefined); - var dir = dirs[0]; +var origCwd = process.cwd +var cwd = null - isDirectory(path.dirname(dir), isdir); +var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform - function isdir(err, isdir) { - if (err) return cb(err); - if (!isdir) return processDirs(cb, dirs.slice(1)); - loadAsFile(dir, opts.package, onfile); - } +process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process) + return cwd +} +try { + process.cwd() +} catch (er) {} - function onfile(err, m, pkg) { - if (err) return cb(err); - if (m) return cb(null, m, pkg); - loadAsDirectory(dir, opts.package, ondir); - } +var chdir = process.chdir +process.chdir = function(d) { + cwd = null + chdir.call(process, d) +} - function ondir(err, n, pkg) { - if (err) return cb(err); - if (n) return cb(null, n, pkg); - processDirs(cb, dirs.slice(1)); - } - } - function loadNodeModules(x, start, cb) { - var thunk = function () { return getPackageCandidates(x, start, opts); }; - processDirs( - cb, - packageIterator ? packageIterator(x, start, thunk, opts) : thunk() - ); - } -}; +module.exports = patch +function patch (fs) { + // (re-)implement some things that are known busted or missing. -/***/ }), -/* 194 */ -/***/ (function(module, exports) { + // lchmod, broken prior to 0.6.2 + // back-port the fix here. + if (constants.hasOwnProperty('O_SYMLINK') && + process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs) + } -module.exports = function () { - // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi - var origPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = function (_, stack) { return stack; }; - var stack = (new Error()).stack; - Error.prepareStackTrace = origPrepareStackTrace; - return stack[2].getFileName(); -}; + // lutimes implementation, or no-op + if (!fs.lutimes) { + patchLutimes(fs) + } + // https://github.com/isaacs/node-graceful-fs/issues/4 + // Chown should not fail on einval or eperm if non-root. + // It should not fail on enosys ever, as this just indicates + // that a fs doesn't support the intended operation. -/***/ }), -/* 195 */ -/***/ (function(module, exports, __webpack_require__) { + fs.chown = chownFix(fs.chown) + fs.fchown = chownFix(fs.fchown) + fs.lchown = chownFix(fs.lchown) -var path = __webpack_require__(4); -var parse = path.parse || __webpack_require__(196); + fs.chmod = chmodFix(fs.chmod) + fs.fchmod = chmodFix(fs.fchmod) + fs.lchmod = chmodFix(fs.lchmod) -var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) { - var prefix = '/'; - if ((/^([A-Za-z]:)/).test(absoluteStart)) { - prefix = ''; - } else if ((/^\\\\/).test(absoluteStart)) { - prefix = '\\\\'; - } + fs.chownSync = chownFixSync(fs.chownSync) + fs.fchownSync = chownFixSync(fs.fchownSync) + fs.lchownSync = chownFixSync(fs.lchownSync) - var paths = [absoluteStart]; - var parsed = parse(absoluteStart); - while (parsed.dir !== paths[paths.length - 1]) { - paths.push(parsed.dir); - parsed = parse(parsed.dir); - } + fs.chmodSync = chmodFixSync(fs.chmodSync) + fs.fchmodSync = chmodFixSync(fs.fchmodSync) + fs.lchmodSync = chmodFixSync(fs.lchmodSync) - return paths.reduce(function (dirs, aPath) { - return dirs.concat(modules.map(function (moduleDir) { - return path.resolve(prefix, aPath, moduleDir); - })); - }, []); -}; + fs.stat = statFix(fs.stat) + fs.fstat = statFix(fs.fstat) + fs.lstat = statFix(fs.lstat) -module.exports = function nodeModulesPaths(start, opts, request) { - var modules = opts && opts.moduleDirectory - ? [].concat(opts.moduleDirectory) - : ['node_modules']; + fs.statSync = statFixSync(fs.statSync) + fs.fstatSync = statFixSync(fs.fstatSync) + fs.lstatSync = statFixSync(fs.lstatSync) - if (opts && typeof opts.paths === 'function') { - return opts.paths( - request, - start, - function () { return getNodeModulesDirs(start, modules); }, - opts - ); + // if lchmod/lchown do not exist, then make them no-ops + if (!fs.lchmod) { + fs.lchmod = function (path, mode, cb) { + if (cb) process.nextTick(cb) + } + fs.lchmodSync = function () {} + } + if (!fs.lchown) { + fs.lchown = function (path, uid, gid, cb) { + if (cb) process.nextTick(cb) } + fs.lchownSync = function () {} + } - var dirs = getNodeModulesDirs(start, modules); - return opts && opts.paths ? dirs.concat(opts.paths) : dirs; -}; + // on Windows, A/V software can lock the directory, causing this + // to fail with an EACCES or EPERM if the directory contains newly + // created files. Try again on failure, for up to 60 seconds. + + // Set the timeout this long because some Windows Anti-Virus, such as Parity + // bit9, may lock files for up to a minute, causing npm package install + // failures. Also, take care to yield the scheduler. Windows scheduling gives + // CPU to a busy looping process, which can cause the program causing the lock + // contention to be starved of CPU by node, so the contention doesn't resolve. + if (platform === "win32") { + fs.rename = (function (fs$rename) { return function (from, to, cb) { + var start = Date.now() + var backoff = 0; + fs$rename(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM") + && Date.now() - start < 60000) { + setTimeout(function() { + fs.stat(to, function (stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er) + }) + }, backoff) + if (backoff < 100) + backoff += 10; + return; + } + if (cb) cb(er) + }) + }})(fs.rename) + } + // if read() returns EAGAIN, then just try it again. + fs.read = (function (fs$read) { return function (fd, buffer, offset, length, position, callback_) { + var callback + if (callback_ && typeof callback_ === 'function') { + var eagCounter = 0 + callback = function (er, _, __) { + if (er && er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + callback_.apply(this, arguments) + } + } + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + }})(fs.read) -/***/ }), -/* 196 */ -/***/ (function(module, exports, __webpack_require__) { + fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { + var eagCounter = 0 + while (true) { + try { + return fs$readSync.call(fs, fd, buffer, offset, length, position) + } catch (er) { + if (er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + continue + } + throw er + } + } + }})(fs.readSync) +} -"use strict"; +function patchLchmod (fs) { + fs.lchmod = function (path, mode, callback) { + fs.open( path + , constants.O_WRONLY | constants.O_SYMLINK + , mode + , function (err, fd) { + if (err) { + if (callback) callback(err) + return + } + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + fs.fchmod(fd, mode, function (err) { + fs.close(fd, function(err2) { + if (callback) callback(err || err2) + }) + }) + }) + } + fs.lchmodSync = function (path, mode) { + var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) -var isWindows = process.platform === 'win32'; + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + var threw = true + var ret + try { + ret = fs.fchmodSync(fd, mode) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } +} -// Regex to split a windows path into three parts: [*, device, slash, -// tail] windows-only -var splitDeviceRe = - /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; +function patchLutimes (fs) { + if (constants.hasOwnProperty("O_SYMLINK")) { + fs.lutimes = function (path, at, mt, cb) { + fs.open(path, constants.O_SYMLINK, function (er, fd) { + if (er) { + if (cb) cb(er) + return + } + fs.futimes(fd, at, mt, function (er) { + fs.close(fd, function (er2) { + if (cb) cb(er || er2) + }) + }) + }) + } -// Regex to split the tail part of the above into [*, dir, basename, ext] -var splitTailRe = - /^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/; + fs.lutimesSync = function (path, at, mt) { + var fd = fs.openSync(path, constants.O_SYMLINK) + var ret + var threw = true + try { + ret = fs.futimesSync(fd, at, mt) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } -var win32 = {}; + } else { + fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } + fs.lutimesSync = function () {} + } +} -// Function to split a filename into [root, dir, basename, ext] -function win32SplitPath(filename) { - // Separate device+slash from tail - var result = splitDeviceRe.exec(filename), - device = (result[1] || '') + (result[2] || ''), - tail = result[3] || ''; - // Split the tail into dir, basename and extension - var result2 = splitTailRe.exec(tail), - dir = result2[1], - basename = result2[2], - ext = result2[3]; - return [device, dir, basename, ext]; +function chmodFix (orig) { + if (!orig) return orig + return function (target, mode, cb) { + return orig.call(fs, target, mode, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } } -win32.parse = function(pathString) { - if (typeof pathString !== 'string') { - throw new TypeError( - "Parameter 'pathString' must be a string, not " + typeof pathString - ); +function chmodFixSync (orig) { + if (!orig) return orig + return function (target, mode) { + try { + return orig.call(fs, target, mode) + } catch (er) { + if (!chownErOk(er)) throw er + } } - var allParts = win32SplitPath(pathString); - if (!allParts || allParts.length !== 4) { - throw new TypeError("Invalid path '" + pathString + "'"); +} + + +function chownFix (orig) { + if (!orig) return orig + return function (target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) } - return { - root: allParts[0], - dir: allParts[0] + allParts[1].slice(0, -1), - base: allParts[2], - ext: allParts[3], - name: allParts[2].slice(0, allParts[2].length - allParts[3].length) - }; -}; +} +function chownFixSync (orig) { + if (!orig) return orig + return function (target, uid, gid) { + try { + return orig.call(fs, target, uid, gid) + } catch (er) { + if (!chownErOk(er)) throw er + } + } +} -// Split a filename into [root, dir, basename, ext], unix version -// 'root' is just a slash, or nothing. -var splitPathRe = - /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; -var posix = {}; +function statFix (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, cb) { + return orig.call(fs, target, function (er, stats) { + if (!stats) return cb.apply(this, arguments) + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + if (cb) cb.apply(this, arguments) + }) + } +} + +function statFixSync (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target) { + var stats = orig.call(fs, target) + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + return stats; + } +} + +// ENOSYS means that the fs doesn't support the op. Just ignore +// that, because it doesn't matter. +// +// if there's no getuid, or if getuid() is something other +// than 0, and the error is EINVAL or EPERM, then just ignore +// it. +// +// This specific case is a silent failure in cp, install, tar, +// and most other unix tools that manage permissions. +// +// When running as root, or if other types of errors are +// encountered, then it's strict. +function chownErOk (er) { + if (!er) + return true + if (er.code === "ENOSYS") + return true -function posixSplitPath(filename) { - return splitPathRe.exec(filename).slice(1); + var nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true + } + + return false } -posix.parse = function(pathString) { - if (typeof pathString !== 'string') { - throw new TypeError( - "Parameter 'pathString' must be a string, not " + typeof pathString - ); - } - var allParts = posixSplitPath(pathString); - if (!allParts || allParts.length !== 4) { - throw new TypeError("Invalid path '" + pathString + "'"); - } - allParts[1] = allParts[1] || ''; - allParts[2] = allParts[2] || ''; - allParts[3] = allParts[3] || ''; +/***/ }), +/* 222 */ +/***/ (function(module, exports, __webpack_require__) { - return { - root: allParts[0], - dir: allParts[0] + allParts[1].slice(0, -1), - base: allParts[2], - ext: allParts[3], - name: allParts[2].slice(0, allParts[2].length - allParts[3].length) - }; -}; +"use strict"; -if (isWindows) - module.exports = win32.parse; -else /* posix */ - module.exports = posix.parse; +var fs = __webpack_require__(133) -module.exports.posix = posix.parse; -module.exports.win32 = win32.parse; +module.exports = clone(fs) +function clone (obj) { + if (obj === null || typeof obj !== 'object') + return obj -/***/ }), -/* 197 */ -/***/ (function(module, exports) { + if (obj instanceof Object) + var copy = { __proto__: obj.__proto__ } + else + var copy = Object.create(null) -module.exports = function (x, opts) { - /** - * This file is purposefully a passthrough. It's expected that third-party - * environments will override it at runtime in order to inject special logic - * into `resolve` (by manipulating the options). One such example is the PnP - * code path in Yarn. - */ + Object.getOwnPropertyNames(obj).forEach(function (key) { + Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) + }) - return opts || {}; -}; + return copy +} /***/ }), -/* 198 */ +/* 223 */ /***/ (function(module, exports, __webpack_require__) { -var core = __webpack_require__(199); +var Stream = __webpack_require__(137).Stream -module.exports = function isCore(x) { - return Object.prototype.hasOwnProperty.call(core, x); -}; +module.exports = legacy +function legacy (fs) { + return { + ReadStream: ReadStream, + WriteStream: WriteStream + } -/***/ }), -/* 199 */ -/***/ (function(module, exports, __webpack_require__) { + function ReadStream (path, options) { + if (!(this instanceof ReadStream)) return new ReadStream(path, options); -var current = (process.versions && process.versions.node && process.versions.node.split('.')) || []; + Stream.call(this); -function specifierIncluded(specifier) { - var parts = specifier.split(' '); - var op = parts.length > 1 ? parts[0] : '='; - var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.'); + var self = this; - for (var i = 0; i < 3; ++i) { - var cur = Number(current[i] || 0); - var ver = Number(versionParts[i] || 0); - if (cur === ver) { - continue; // eslint-disable-line no-restricted-syntax, no-continue - } - if (op === '<') { - return cur < ver; - } else if (op === '>=') { - return cur >= ver; - } else { - return false; - } - } - return op === '>='; -} + this.path = path; + this.fd = null; + this.readable = true; + this.paused = false; -function matchesRange(range) { - var specifiers = range.split(/ ?&& ?/); - if (specifiers.length === 0) { return false; } - for (var i = 0; i < specifiers.length; ++i) { - if (!specifierIncluded(specifiers[i])) { return false; } - } - return true; -} + this.flags = 'r'; + this.mode = 438; /*=0666*/ + this.bufferSize = 64 * 1024; -function versionIncluded(specifierValue) { - if (typeof specifierValue === 'boolean') { return specifierValue; } - if (specifierValue && typeof specifierValue === 'object') { - for (var i = 0; i < specifierValue.length; ++i) { - if (matchesRange(specifierValue[i])) { return true; } - } - return false; + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; } - return matchesRange(specifierValue); -} -var data = __webpack_require__(200); + if (this.encoding) this.setEncoding(this.encoding); -var core = {}; -for (var mod in data) { // eslint-disable-line no-restricted-syntax - if (Object.prototype.hasOwnProperty.call(data, mod)) { - core[mod] = versionIncluded(data[mod]); + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.end === undefined) { + this.end = Infinity; + } else if ('number' !== typeof this.end) { + throw TypeError('end must be a Number'); + } + + if (this.start > this.end) { + throw new Error('start must be <= end'); + } + + this.pos = this.start; } -} -module.exports = core; + if (this.fd !== null) { + process.nextTick(function() { + self._read(); + }); + return; + } -/***/ }), -/* 200 */ -/***/ (function(module) { + fs.open(this.path, this.flags, this.mode, function (err, fd) { + if (err) { + self.emit('error', err); + self.readable = false; + return; + } -module.exports = JSON.parse("{\"assert\":true,\"async_hooks\":\">= 8\",\"buffer_ieee754\":\"< 0.9.7\",\"buffer\":true,\"child_process\":true,\"cluster\":true,\"console\":true,\"constants\":true,\"crypto\":true,\"_debug_agent\":\">= 1 && < 8\",\"_debugger\":\"< 8\",\"dgram\":true,\"dns\":true,\"domain\":true,\"events\":true,\"freelist\":\"< 6\",\"fs\":true,\"fs/promises\":[\">= 10 && < 10.1\",\">= 14\"],\"_http_agent\":\">= 0.11.1\",\"_http_client\":\">= 0.11.1\",\"_http_common\":\">= 0.11.1\",\"_http_incoming\":\">= 0.11.1\",\"_http_outgoing\":\">= 0.11.1\",\"_http_server\":\">= 0.11.1\",\"http\":true,\"http2\":\">= 8.8\",\"https\":true,\"inspector\":\">= 8.0.0\",\"_linklist\":\"< 8\",\"module\":true,\"net\":true,\"node-inspect/lib/_inspect\":\">= 7.6.0 && < 12\",\"node-inspect/lib/internal/inspect_client\":\">= 7.6.0 && < 12\",\"node-inspect/lib/internal/inspect_repl\":\">= 7.6.0 && < 12\",\"os\":true,\"path\":true,\"perf_hooks\":\">= 8.5\",\"process\":\">= 1\",\"punycode\":true,\"querystring\":true,\"readline\":true,\"repl\":true,\"smalloc\":\">= 0.11.5 && < 3\",\"_stream_duplex\":\">= 0.9.4\",\"_stream_transform\":\">= 0.9.4\",\"_stream_wrap\":\">= 1.4.1\",\"_stream_passthrough\":\">= 0.9.4\",\"_stream_readable\":\">= 0.9.4\",\"_stream_writable\":\">= 0.9.4\",\"stream\":true,\"string_decoder\":true,\"sys\":true,\"timers\":true,\"_tls_common\":\">= 0.11.13\",\"_tls_legacy\":\">= 0.11.3 && < 10\",\"_tls_wrap\":\">= 0.11.3\",\"tls\":true,\"trace_events\":\">= 10\",\"tty\":true,\"url\":true,\"util\":true,\"v8/tools/arguments\":\">= 10 && < 12\",\"v8/tools/codemap\":[\">= 4.4.0 && < 5\",\">= 5.2.0 && < 12\"],\"v8/tools/consarray\":[\">= 4.4.0 && < 5\",\">= 5.2.0 && < 12\"],\"v8/tools/csvparser\":[\">= 4.4.0 && < 5\",\">= 5.2.0 && < 12\"],\"v8/tools/logreader\":[\">= 4.4.0 && < 5\",\">= 5.2.0 && < 12\"],\"v8/tools/profile_view\":[\">= 4.4.0 && < 5\",\">= 5.2.0 && < 12\"],\"v8/tools/splaytree\":[\">= 4.4.0 && < 5\",\">= 5.2.0 && < 12\"],\"v8\":\">= 1\",\"vm\":true,\"wasi\":\">= 13.4 && < 13.5\",\"worker_threads\":\">= 11.7\",\"zlib\":true}"); + self.fd = fd; + self.emit('open', fd); + self._read(); + }) + } -/***/ }), -/* 201 */ -/***/ (function(module, exports, __webpack_require__) { + function WriteStream (path, options) { + if (!(this instanceof WriteStream)) return new WriteStream(path, options); -var isCore = __webpack_require__(198); -var fs = __webpack_require__(132); -var path = __webpack_require__(4); -var caller = __webpack_require__(194); -var nodeModulesPaths = __webpack_require__(195); -var normalizeOptions = __webpack_require__(197); + Stream.call(this); -var realpathFS = fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; + this.path = path; + this.fd = null; + this.writable = true; -var defaultIsFile = function isFile(file) { - try { - var stat = fs.statSync(file); - } catch (e) { - if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; - throw e; - } - return stat.isFile() || stat.isFIFO(); -}; + this.flags = 'w'; + this.encoding = 'binary'; + this.mode = 438; /*=0666*/ + this.bytesWritten = 0; -var defaultIsDir = function isDirectory(dir) { - try { - var stat = fs.statSync(dir); - } catch (e) { - if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; - throw e; - } - return stat.isDirectory(); -}; + options = options || {}; -var defaultRealpathSync = function realpathSync(x) { - try { - return realpathFS(x); - } catch (realpathErr) { - if (realpathErr.code !== 'ENOENT') { - throw realpathErr; - } + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; } - return x; -}; -var maybeRealpathSync = function maybeRealpathSync(realpathSync, x, opts) { - if (opts && opts.preserveSymlinks === false) { - return realpathSync(x); - } - return x; -}; + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.start < 0) { + throw new Error('start must be >= zero'); + } -var getPackageCandidates = function getPackageCandidates(x, start, opts) { - var dirs = nodeModulesPaths(start, opts, x); - for (var i = 0; i < dirs.length; i++) { - dirs[i] = path.join(dirs[i], x); + this.pos = this.start; } - return dirs; -}; -module.exports = function resolveSync(x, options) { - if (typeof x !== 'string') { - throw new TypeError('Path must be a string.'); + this.busy = false; + this._queue = []; + + if (this.fd === null) { + this._open = fs.open; + this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); + this.flush(); } - var opts = normalizeOptions(x, options); + } +} - var isFile = opts.isFile || defaultIsFile; - var readFileSync = opts.readFileSync || fs.readFileSync; - var isDirectory = opts.isDirectory || defaultIsDir; - var realpathSync = opts.realpathSync || defaultRealpathSync; - var packageIterator = opts.packageIterator; - var extensions = opts.extensions || ['.js']; - var basedir = opts.basedir || path.dirname(caller()); - var parent = opts.filename || basedir; +/***/ }), +/* 224 */ +/***/ (function(module, exports, __webpack_require__) { - opts.paths = opts.paths || []; +/** + * @preserve + * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013) + * + * @author Jens Taylor + * @see http://github.com/homebrewing/brauhaus-diff + * @author Gary Court + * @see http://github.com/garycourt/murmurhash-js + * @author Austin Appleby + * @see http://sites.google.com/site/murmurhash/ + */ +(function(){ + var cache; - // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory - var absoluteStart = maybeRealpathSync(realpathSync, path.resolve(basedir), opts); + // Call this function without `new` to use the cached object (good for + // single-threaded environments), or with `new` to create a new object. + // + // @param {string} key A UTF-16 or ASCII string + // @param {number} seed An optional positive integer + // @return {object} A MurmurHash3 object for incremental hashing + function MurmurHash3(key, seed) { + var m = this instanceof MurmurHash3 ? this : cache; + m.reset(seed) + if (typeof key === 'string' && key.length > 0) { + m.hash(key); + } - if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { - var res = path.resolve(absoluteStart, x); - if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; - var m = loadAsFileSync(res) || loadAsDirectorySync(res); - if (m) return maybeRealpathSync(realpathSync, m, opts); - } else if (isCore(x)) { - return x; - } else { - var n = loadNodeModulesSync(x, absoluteStart); - if (n) return maybeRealpathSync(realpathSync, n, opts); - } + if (m !== this) { + return m; + } + }; - var err = new Error("Cannot find module '" + x + "' from '" + parent + "'"); - err.code = 'MODULE_NOT_FOUND'; - throw err; + // Incrementally add a string to this hash + // + // @param {string} key A UTF-16 or ASCII string + // @return {object} this + MurmurHash3.prototype.hash = function(key) { + var h1, k1, i, top, len; - function loadAsFileSync(x) { - var pkg = loadpkg(path.dirname(x)); + len = key.length; + this.len += len; - if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) { - var rfile = path.relative(pkg.dir, x); - var r = opts.pathFilter(pkg.pkg, x, rfile); - if (r) { - x = path.resolve(pkg.dir, r); // eslint-disable-line no-param-reassign - } + k1 = this.k1; + i = 0; + switch (this.rem) { + case 0: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) : 0; + case 1: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 8 : 0; + case 2: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 16 : 0; + case 3: + k1 ^= len > i ? (key.charCodeAt(i) & 0xff) << 24 : 0; + k1 ^= len > i ? (key.charCodeAt(i++) & 0xff00) >> 8 : 0; } - if (isFile(x)) { - return x; - } + this.rem = (len + this.rem) & 3; // & 3 is same as % 4 + len -= this.rem; + if (len > 0) { + h1 = this.h1; + while (1) { + k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff; + k1 = (k1 << 15) | (k1 >>> 17); + k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff; - for (var i = 0; i < extensions.length; i++) { - var file = x + extensions[i]; - if (isFile(file)) { - return file; - } - } - } + h1 ^= k1; + h1 = (h1 << 13) | (h1 >>> 19); + h1 = (h1 * 5 + 0xe6546b64) & 0xffffffff; - function loadpkg(dir) { - if (dir === '' || dir === '/') return; - if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { - return; - } - if ((/[/\\]node_modules[/\\]*$/).test(dir)) return; + if (i >= len) { + break; + } - var pkgfile = path.join(maybeRealpathSync(realpathSync, dir, opts), 'package.json'); + k1 = ((key.charCodeAt(i++) & 0xffff)) ^ + ((key.charCodeAt(i++) & 0xffff) << 8) ^ + ((key.charCodeAt(i++) & 0xffff) << 16); + top = key.charCodeAt(i++); + k1 ^= ((top & 0xff) << 24) ^ + ((top & 0xff00) >> 8); + } - if (!isFile(pkgfile)) { - return loadpkg(path.dirname(dir)); + k1 = 0; + switch (this.rem) { + case 3: k1 ^= (key.charCodeAt(i + 2) & 0xffff) << 16; + case 2: k1 ^= (key.charCodeAt(i + 1) & 0xffff) << 8; + case 1: k1 ^= (key.charCodeAt(i) & 0xffff); + } + + this.h1 = h1; } - var body = readFileSync(pkgfile); + this.k1 = k1; + return this; + }; - try { - var pkg = JSON.parse(body); - } catch (jsonErr) {} + // Get the result of this hash + // + // @return {number} The 32-bit hash + MurmurHash3.prototype.result = function() { + var k1, h1; + + k1 = this.k1; + h1 = this.h1; - if (pkg && opts.packageFilter) { - // v2 will pass pkgfile - pkg = opts.packageFilter(pkg, /*pkgfile,*/ dir); // eslint-disable-line spaced-comment + if (k1 > 0) { + k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff; + k1 = (k1 << 15) | (k1 >>> 17); + k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff; + h1 ^= k1; } - return { pkg: pkg, dir: dir }; - } - - function loadAsDirectorySync(x) { - var pkgfile = path.join(maybeRealpathSync(realpathSync, x, opts), '/package.json'); - if (isFile(pkgfile)) { - try { - var body = readFileSync(pkgfile, 'UTF8'); - var pkg = JSON.parse(body); - } catch (e) {} + h1 ^= this.len; - if (pkg && opts.packageFilter) { - // v2 will pass pkgfile - pkg = opts.packageFilter(pkg, /*pkgfile,*/ x); // eslint-disable-line spaced-comment - } + h1 ^= h1 >>> 16; + h1 = (h1 * 0xca6b + (h1 & 0xffff) * 0x85eb0000) & 0xffffffff; + h1 ^= h1 >>> 13; + h1 = (h1 * 0xae35 + (h1 & 0xffff) * 0xc2b20000) & 0xffffffff; + h1 ^= h1 >>> 16; - if (pkg && pkg.main) { - if (typeof pkg.main !== 'string') { - var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); - mainError.code = 'INVALID_PACKAGE_MAIN'; - throw mainError; - } - if (pkg.main === '.' || pkg.main === './') { - pkg.main = 'index'; - } - try { - var m = loadAsFileSync(path.resolve(x, pkg.main)); - if (m) return m; - var n = loadAsDirectorySync(path.resolve(x, pkg.main)); - if (n) return n; - } catch (e) {} - } - } + return h1 >>> 0; + }; - return loadAsFileSync(path.join(x, '/index')); - } + // Reset the hash object for reuse + // + // @param {number} seed An optional positive integer + MurmurHash3.prototype.reset = function(seed) { + this.h1 = typeof seed === 'number' ? seed : 0; + this.rem = this.k1 = this.len = 0; + return this; + }; - function loadNodeModulesSync(x, start) { - var thunk = function () { return getPackageCandidates(x, start, opts); }; - var dirs = packageIterator ? packageIterator(x, start, thunk, opts) : thunk(); + // A cached object to use. This can be safely used if you're in a single- + // threaded environment, otherwise you need to create new hashes to use. + cache = new MurmurHash3(); - for (var i = 0; i < dirs.length; i++) { - var dir = dirs[i]; - if (isDirectory(path.dirname(dir))) { - var m = loadAsFileSync(dir); - if (m) return m; - var n = loadAsDirectorySync(dir); - if (n) return n; - } - } - } -}; + if (true) { + module.exports = MurmurHash3; + } else {} +}()); /***/ }), -/* 202 */ -/***/ (function(module, exports) { +/* 225 */ +/***/ (function(module, exports, __webpack_require__) { -module.exports = extractDescription +// Note: since nyc uses this module to output coverage, any lines +// that are in the direct sync flow of nyc's outputCoverage are +// ignored, since we can never get coverage for them. +var assert = __webpack_require__(139) +var signals = __webpack_require__(226) -// Extracts description from contents of a readme file in markdown format -function extractDescription (d) { - if (!d) return; - if (d === "ERROR: No README data found!") return; - // the first block of text before the first heading - // that isn't the first line heading - d = d.trim().split('\n') - for (var s = 0; d[s] && d[s].trim().match(/^(#|$)/); s ++); - var l = d.length - for (var e = s + 1; e < l && d[e].trim(); e ++); - return d.slice(s, e).join(' ').trim() +var EE = __webpack_require__(155) +/* istanbul ignore if */ +if (typeof EE !== 'function') { + EE = EE.EventEmitter +} + +var emitter +if (process.__signal_exit_emitter__) { + emitter = process.__signal_exit_emitter__ +} else { + emitter = process.__signal_exit_emitter__ = new EE() + emitter.count = 0 + emitter.emitted = {} } +// Because this emitter is a global, we have to check to see if a +// previous version of this library failed to enable infinite listeners. +// I know what you're about to say. But literally everything about +// signal-exit is a compromise with evil. Get used to it. +if (!emitter.infinite) { + emitter.setMaxListeners(Infinity) + emitter.infinite = true +} -/***/ }), -/* 203 */ -/***/ (function(module) { - -module.exports = JSON.parse("{\"topLevel\":{\"dependancies\":\"dependencies\",\"dependecies\":\"dependencies\",\"depdenencies\":\"dependencies\",\"devEependencies\":\"devDependencies\",\"depends\":\"dependencies\",\"dev-dependencies\":\"devDependencies\",\"devDependences\":\"devDependencies\",\"devDepenencies\":\"devDependencies\",\"devdependencies\":\"devDependencies\",\"repostitory\":\"repository\",\"repo\":\"repository\",\"prefereGlobal\":\"preferGlobal\",\"hompage\":\"homepage\",\"hampage\":\"homepage\",\"autohr\":\"author\",\"autor\":\"author\",\"contributers\":\"contributors\",\"publicationConfig\":\"publishConfig\",\"script\":\"scripts\"},\"bugs\":{\"web\":\"url\",\"name\":\"url\"},\"script\":{\"server\":\"start\",\"tests\":\"test\"}}"); - -/***/ }), -/* 204 */ -/***/ (function(module, exports, __webpack_require__) { +module.exports = function (cb, opts) { + assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler') -var util = __webpack_require__(111) -var messages = __webpack_require__(205) + if (loaded === false) { + load() + } -module.exports = function() { - var args = Array.prototype.slice.call(arguments, 0) - var warningName = args.shift() - if (warningName == "typo") { - return makeTypoWarning.apply(null,args) + var ev = 'exit' + if (opts && opts.alwaysLast) { + ev = 'afterexit' } - else { - var msgTemplate = messages[warningName] ? messages[warningName] : warningName + ": '%s'" - args.unshift(msgTemplate) - return util.format.apply(null, args) + + var remove = function () { + emitter.removeListener(ev, cb) + if (emitter.listeners('exit').length === 0 && + emitter.listeners('afterexit').length === 0) { + unload() + } } + emitter.on(ev, cb) + + return remove } -function makeTypoWarning (providedName, probableName, field) { - if (field) { - providedName = field + "['" + providedName + "']" - probableName = field + "['" + probableName + "']" +module.exports.unload = unload +function unload () { + if (!loaded) { + return } - return util.format(messages.typo, providedName, probableName) -} + loaded = false + signals.forEach(function (sig) { + try { + process.removeListener(sig, sigListeners[sig]) + } catch (er) {} + }) + process.emit = originalProcessEmit + process.reallyExit = originalProcessReallyExit + emitter.count -= 1 +} -/***/ }), -/* 205 */ -/***/ (function(module) { +function emit (event, code, signal) { + if (emitter.emitted[event]) { + return + } + emitter.emitted[event] = true + emitter.emit(event, code, signal) +} -module.exports = JSON.parse("{\"repositories\":\"'repositories' (plural) Not supported. Please pick one as the 'repository' field\",\"missingRepository\":\"No repository field.\",\"brokenGitUrl\":\"Probably broken git url: %s\",\"nonObjectScripts\":\"scripts must be an object\",\"nonStringScript\":\"script values must be string commands\",\"nonArrayFiles\":\"Invalid 'files' member\",\"invalidFilename\":\"Invalid filename in 'files' list: %s\",\"nonArrayBundleDependencies\":\"Invalid 'bundleDependencies' list. Must be array of package names\",\"nonStringBundleDependency\":\"Invalid bundleDependencies member: %s\",\"nonDependencyBundleDependency\":\"Non-dependency in bundleDependencies: %s\",\"nonObjectDependencies\":\"%s field must be an object\",\"nonStringDependency\":\"Invalid dependency: %s %s\",\"deprecatedArrayDependencies\":\"specifying %s as array is deprecated\",\"deprecatedModules\":\"modules field is deprecated\",\"nonArrayKeywords\":\"keywords should be an array of strings\",\"nonStringKeyword\":\"keywords should be an array of strings\",\"conflictingName\":\"%s is also the name of a node core module.\",\"nonStringDescription\":\"'description' field should be a string\",\"missingDescription\":\"No description\",\"missingReadme\":\"No README data\",\"missingLicense\":\"No license field.\",\"nonEmailUrlBugsString\":\"Bug string field must be url, email, or {email,url}\",\"nonUrlBugsUrlField\":\"bugs.url field must be a string url. Deleted.\",\"nonEmailBugsEmailField\":\"bugs.email field must be a string email. Deleted.\",\"emptyNormalizedBugs\":\"Normalized value of bugs field is an empty object. Deleted.\",\"nonUrlHomepage\":\"homepage field must be a string url. Deleted.\",\"invalidLicense\":\"license should be a valid SPDX license expression\",\"typo\":\"%s should probably be %s.\"}"); +// { : , ... } +var sigListeners = {} +signals.forEach(function (sig) { + sigListeners[sig] = function listener () { + // If there are no other listeners, an exit is coming! + // Simplest way: remove us and then re-send the signal. + // We know that this will kill the process, so we can + // safely emit now. + var listeners = process.listeners(sig) + if (listeners.length === emitter.count) { + unload() + emit('exit', null, sig) + /* istanbul ignore next */ + emit('afterexit', null, sig) + /* istanbul ignore next */ + process.kill(process.pid, sig) + } + } +}) -/***/ }), -/* 206 */ -/***/ (function(module, exports, __webpack_require__) { +module.exports.signals = function () { + return signals +} -"use strict"; +module.exports.load = load -const path = __webpack_require__(4); -const writeJsonFile = __webpack_require__(207); -const sortKeys = __webpack_require__(221); +var loaded = false -const dependencyKeys = new Set([ - 'dependencies', - 'devDependencies', - 'optionalDependencies', - 'peerDependencies' -]); +function load () { + if (loaded) { + return + } + loaded = true -function normalize(packageJson) { - const result = {}; + // This is the number of onSignalExit's that are in play. + // It's important so that we can count the correct number of + // listeners on signals, and don't wait for the other one to + // handle it instead of us. + emitter.count += 1 - for (const key of Object.keys(packageJson)) { - if (!dependencyKeys.has(key)) { - result[key] = packageJson[key]; - } else if (Object.keys(packageJson[key]).length !== 0) { - result[key] = sortKeys(packageJson[key]); - } - } + signals = signals.filter(function (sig) { + try { + process.on(sig, sigListeners[sig]) + return true + } catch (er) { + return false + } + }) - return result; + process.emit = processEmit + process.reallyExit = processReallyExit } -module.exports = async (filePath, data, options) => { - if (typeof filePath !== 'string') { - options = data; - data = filePath; - filePath = '.'; - } - - options = { - normalize: true, - ...options, - detectIndent: true - }; +var originalProcessReallyExit = process.reallyExit +function processReallyExit (code) { + process.exitCode = code || 0 + emit('exit', process.exitCode, null) + /* istanbul ignore next */ + emit('afterexit', process.exitCode, null) + /* istanbul ignore next */ + originalProcessReallyExit.call(process, process.exitCode) +} - filePath = path.basename(filePath) === 'package.json' ? filePath : path.join(filePath, 'package.json'); +var originalProcessEmit = process.emit +function processEmit (ev, arg) { + if (ev === 'exit') { + if (arg !== undefined) { + process.exitCode = arg + } + var ret = originalProcessEmit.apply(this, arguments) + emit('exit', process.exitCode, null) + /* istanbul ignore next */ + emit('afterexit', process.exitCode, null) + return ret + } else { + return originalProcessEmit.apply(this, arguments) + } +} - data = options.normalize ? normalize(data) : data; - return writeJsonFile(filePath, data, options); -}; +/***/ }), +/* 226 */ +/***/ (function(module, exports) { -module.exports.sync = (filePath, data, options) => { - if (typeof filePath !== 'string') { - options = data; - data = filePath; - filePath = '.'; - } +// This is not the set of all possible signals. +// +// It IS, however, the set of all signals that trigger +// an exit on either Linux or BSD systems. Linux is a +// superset of the signal names supported on BSD, and +// the unknown signals just fail to register, so we can +// catch that easily enough. +// +// Don't bother with SIGKILL. It's uncatchable, which +// means that we can't fire any callbacks anyway. +// +// If a user does happen to register a handler on a non- +// fatal signal like SIGWINCH or something, and then +// exit, it'll end up firing `process.emit('exit')`, so +// the handler will be fired anyway. +// +// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised +// artificially, inherently leave the process in a +// state from which it is not safe to try and enter JS +// listeners. +module.exports = [ + 'SIGABRT', + 'SIGALRM', + 'SIGHUP', + 'SIGINT', + 'SIGTERM' +] - options = { - normalize: true, - ...options, - detectIndent: true - }; +if (process.platform !== 'win32') { + module.exports.push( + 'SIGVTALRM', + 'SIGXCPU', + 'SIGXFSZ', + 'SIGUSR2', + 'SIGTRAP', + 'SIGSYS', + 'SIGQUIT', + 'SIGIOT' + // should detect profiler and enable/disable accordingly. + // see #21 + // 'SIGPROF' + ) +} - filePath = path.basename(filePath) === 'package.json' ? filePath : path.join(filePath, 'package.json'); +if (process.platform === 'linux') { + module.exports.push( + 'SIGIO', + 'SIGPOLL', + 'SIGPWR', + 'SIGSTKFLT', + 'SIGUNUSED' + ) +} - data = options.normalize ? normalize(data) : data; - writeJsonFile.sync(filePath, data, options); -}; +/***/ }), +/* 227 */ +/***/ (function(module, exports) { +module.exports = require(undefined); /***/ }), -/* 207 */ +/* 228 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const path = __webpack_require__(4); -const fs = __webpack_require__(208); -const writeFileAtomic = __webpack_require__(212); -const sortKeys = __webpack_require__(221); -const makeDir = __webpack_require__(223); -const pify = __webpack_require__(224); -const detectIndent = __webpack_require__(225); +const isPlainObj = __webpack_require__(229); -const init = (fn, filePath, data, options) => { - if (!filePath) { - throw new TypeError('Expected a filepath'); +module.exports = (obj, opts) => { + if (!isPlainObj(obj)) { + throw new TypeError('Expected a plain object'); } - if (data === undefined) { - throw new TypeError('Expected data to stringify'); + opts = opts || {}; + + // DEPRECATED + if (typeof opts === 'function') { + throw new TypeError('Specify the compare function as an option instead'); } - options = Object.assign({ - indent: '\t', - sortKeys: false - }, options); + const deep = opts.deep; + const seenInput = []; + const seenOutput = []; - if (options.sortKeys) { - data = sortKeys(data, { - deep: true, - compare: typeof options.sortKeys === 'function' ? options.sortKeys : undefined - }); - } + const sortKeys = x => { + const seenIndex = seenInput.indexOf(x); - return fn(filePath, data, options); -}; + if (seenIndex !== -1) { + return seenOutput[seenIndex]; + } -const readFile = filePath => pify(fs.readFile)(filePath, 'utf8').catch(() => {}); + const ret = {}; + const keys = Object.keys(x).sort(opts.compare); -const main = (filePath, data, options) => { - return (options.detectIndent ? readFile(filePath) : Promise.resolve()) - .then(string => { - const indent = string ? detectIndent(string).indent : options.indent; - const json = JSON.stringify(data, options.replacer, indent); + seenInput.push(x); + seenOutput.push(ret); - return pify(writeFileAtomic)(filePath, `${json}\n`, {mode: options.mode}); - }); -}; + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const val = x[key]; -const mainSync = (filePath, data, options) => { - let {indent} = options; + if (deep && Array.isArray(val)) { + const retArr = []; - if (options.detectIndent) { - try { - const file = fs.readFileSync(filePath, 'utf8'); - indent = detectIndent(file).indent; - } catch (error) { - if (error.code !== 'ENOENT') { - throw error; - } - } - } + for (let j = 0; j < val.length; j++) { + retArr[j] = isPlainObj(val[j]) ? sortKeys(val[j]) : val[j]; + } - const json = JSON.stringify(data, options.replacer, indent); + ret[key] = retArr; + continue; + } - return writeFileAtomic.sync(filePath, `${json}\n`, {mode: options.mode}); -}; + ret[key] = deep && isPlainObj(val) ? sortKeys(val) : val; + } -const writeJsonFile = (filePath, data, options) => { - return makeDir(path.dirname(filePath), {fs}) - .then(() => init(main, filePath, data, options)); -}; + return ret; + }; -module.exports = writeJsonFile; -// TODO: Remove this for the next major release -module.exports.default = writeJsonFile; -module.exports.sync = (filePath, data, options) => { - makeDir.sync(path.dirname(filePath), {fs}); - init(mainSync, filePath, data, options); + return sortKeys(obj); }; /***/ }), -/* 208 */ +/* 229 */ /***/ (function(module, exports, __webpack_require__) { -var fs = __webpack_require__(132) -var polyfills = __webpack_require__(209) -var legacy = __webpack_require__(210) -var clone = __webpack_require__(211) - -var queue = [] - -var util = __webpack_require__(111) - -function noop () {} - -var debug = noop -if (util.debuglog) - debug = util.debuglog('gfs4') -else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) - debug = function() { - var m = util.format.apply(util, arguments) - m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') - console.error(m) - } - -if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { - process.on('exit', function() { - debug(queue) - __webpack_require__(138).equal(queue.length, 0) - }) -} - -module.exports = patch(clone(fs)) -if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { - module.exports = patch(fs) - fs.__patched = true; -} - -// Always patch fs.close/closeSync, because we want to -// retry() whenever a close happens *anywhere* in the program. -// This is essential when multiple graceful-fs instances are -// in play at the same time. -module.exports.close = (function (fs$close) { return function (fd, cb) { - return fs$close.call(fs, fd, function (err) { - if (!err) - retry() - - if (typeof cb === 'function') - cb.apply(this, arguments) - }) -}})(fs.close) - -module.exports.closeSync = (function (fs$closeSync) { return function (fd) { - // Note that graceful-fs also retries when fs.closeSync() fails. - // Looks like a bug to me, although it's probably a harmless one. - var rval = fs$closeSync.apply(fs, arguments) - retry() - return rval -}})(fs.closeSync) +"use strict"; -// Only patch fs once, otherwise we'll run into a memory leak if -// graceful-fs is loaded multiple times, such as in test environments that -// reset the loaded modules between tests. -// We look for the string `graceful-fs` from the comment above. This -// way we are not adding any extra properties and it will detect if older -// versions of graceful-fs are installed. -if (!/\bgraceful-fs\b/.test(fs.closeSync.toString())) { - fs.closeSync = module.exports.closeSync; - fs.close = module.exports.close; -} +var toString = Object.prototype.toString; -function patch (fs) { - // Everything that references the open() function needs to be in here - polyfills(fs) - fs.gracefulify = patch - fs.FileReadStream = ReadStream; // Legacy name. - fs.FileWriteStream = WriteStream; // Legacy name. - fs.createReadStream = createReadStream - fs.createWriteStream = createWriteStream - var fs$readFile = fs.readFile - fs.readFile = readFile - function readFile (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null +module.exports = function (x) { + var prototype; + return toString.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); +}; - return go$readFile(path, options, cb) - function go$readFile (path, options, cb) { - return fs$readFile(path, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readFile, [path, options, cb]]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - }) - } - } +/***/ }), +/* 230 */ +/***/ (function(module, exports, __webpack_require__) { - var fs$writeFile = fs.writeFile - fs.writeFile = writeFile - function writeFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null +"use strict"; - return go$writeFile(path, data, options, cb) +const fs = __webpack_require__(133); +const path = __webpack_require__(4); +const pify = __webpack_require__(231); +const semver = __webpack_require__(189); - function go$writeFile (path, data, options, cb) { - return fs$writeFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$writeFile, [path, data, options, cb]]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - }) - } - } +const defaults = { + mode: 0o777 & (~process.umask()), + fs +}; - var fs$appendFile = fs.appendFile - if (fs$appendFile) - fs.appendFile = appendFile - function appendFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null +const useNativeRecursiveOption = semver.satisfies(process.version, '>=10.12.0'); - return go$appendFile(path, data, options, cb) +// https://github.com/nodejs/node/issues/8987 +// https://github.com/libuv/libuv/pull/1088 +const checkPath = pth => { + if (process.platform === 'win32') { + const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, '')); - function go$appendFile (path, data, options, cb) { - return fs$appendFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$appendFile, [path, data, options, cb]]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - }) - } - } + if (pathHasInvalidWinCharacters) { + const error = new Error(`Path contains invalid characters: ${pth}`); + error.code = 'EINVAL'; + throw error; + } + } +}; - var fs$readdir = fs.readdir - fs.readdir = readdir - function readdir (path, options, cb) { - var args = [path] - if (typeof options !== 'function') { - args.push(options) - } else { - cb = options - } - args.push(go$readdir$cb) +const permissionError = pth => { + // This replicates the exception of `fs.mkdir` with native the + // `recusive` option when run on an invalid drive under Windows. + const error = new Error(`operation not permitted, mkdir '${pth}'`); + error.code = 'EPERM'; + error.errno = -4048; + error.path = pth; + error.syscall = 'mkdir'; + return error; +}; - return go$readdir(args) +const makeDir = (input, options) => Promise.resolve().then(() => { + checkPath(input); + options = Object.assign({}, defaults, options); - function go$readdir$cb (err, files) { - if (files && files.sort) - files.sort() + // TODO: Use util.promisify when targeting Node.js 8 + const mkdir = pify(options.fs.mkdir); + const stat = pify(options.fs.stat); - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readdir, [args]]) + if (useNativeRecursiveOption && options.fs.mkdir === fs.mkdir) { + const pth = path.resolve(input); - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - } - } + return mkdir(pth, { + mode: options.mode, + recursive: true + }).then(() => pth); + } - function go$readdir (args) { - return fs$readdir.apply(fs, args) - } + const make = pth => { + return mkdir(pth, options.mode) + .then(() => pth) + .catch(error => { + if (error.code === 'EPERM') { + throw error; + } - if (process.version.substr(0, 4) === 'v0.8') { - var legStreams = legacy(fs) - ReadStream = legStreams.ReadStream - WriteStream = legStreams.WriteStream - } + if (error.code === 'ENOENT') { + if (path.dirname(pth) === pth) { + throw permissionError(pth); + } - var fs$ReadStream = fs.ReadStream - if (fs$ReadStream) { - ReadStream.prototype = Object.create(fs$ReadStream.prototype) - ReadStream.prototype.open = ReadStream$open - } + if (error.message.includes('null bytes')) { + throw error; + } - var fs$WriteStream = fs.WriteStream - if (fs$WriteStream) { - WriteStream.prototype = Object.create(fs$WriteStream.prototype) - WriteStream.prototype.open = WriteStream$open - } + return make(path.dirname(pth)).then(() => make(pth)); + } - fs.ReadStream = ReadStream - fs.WriteStream = WriteStream + return stat(pth) + .then(stats => stats.isDirectory() ? pth : Promise.reject()) + .catch(() => { + throw error; + }); + }); + }; - function ReadStream (path, options) { - if (this instanceof ReadStream) - return fs$ReadStream.apply(this, arguments), this - else - return ReadStream.apply(Object.create(ReadStream.prototype), arguments) - } + return make(path.resolve(input)); +}); - function ReadStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - if (that.autoClose) - that.destroy() +module.exports = makeDir; +module.exports.default = makeDir; - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - that.read() - } - }) - } +module.exports.sync = (input, options) => { + checkPath(input); + options = Object.assign({}, defaults, options); - function WriteStream (path, options) { - if (this instanceof WriteStream) - return fs$WriteStream.apply(this, arguments), this - else - return WriteStream.apply(Object.create(WriteStream.prototype), arguments) - } + if (useNativeRecursiveOption && options.fs.mkdirSync === fs.mkdirSync) { + const pth = path.resolve(input); - function WriteStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - that.destroy() - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - } - }) - } + fs.mkdirSync(pth, { + mode: options.mode, + recursive: true + }); - function createReadStream (path, options) { - return new ReadStream(path, options) - } + return pth; + } - function createWriteStream (path, options) { - return new WriteStream(path, options) - } + const make = pth => { + try { + options.fs.mkdirSync(pth, options.mode); + } catch (error) { + if (error.code === 'EPERM') { + throw error; + } - var fs$open = fs.open - fs.open = open - function open (path, flags, mode, cb) { - if (typeof mode === 'function') - cb = mode, mode = null + if (error.code === 'ENOENT') { + if (path.dirname(pth) === pth) { + throw permissionError(pth); + } - return go$open(path, flags, mode, cb) + if (error.message.includes('null bytes')) { + throw error; + } - function go$open (path, flags, mode, cb) { - return fs$open(path, flags, mode, function (err, fd) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$open, [path, flags, mode, cb]]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - }) - } - } + make(path.dirname(pth)); + return make(pth); + } - return fs -} + try { + if (!options.fs.statSync(pth).isDirectory()) { + throw new Error('The path is not a directory'); + } + } catch (_) { + throw error; + } + } -function enqueue (elem) { - debug('ENQUEUE', elem[0].name, elem[1]) - queue.push(elem) -} + return pth; + }; -function retry () { - var elem = queue.shift() - if (elem) { - debug('RETRY', elem[0].name, elem[1]) - elem[0].apply(null, elem[1]) - } -} + return make(path.resolve(input)); +}; /***/ }), -/* 209 */ +/* 231 */ /***/ (function(module, exports, __webpack_require__) { -var constants = __webpack_require__(134) - -var origCwd = process.cwd -var cwd = null - -var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform - -process.cwd = function() { - if (!cwd) - cwd = origCwd.call(process) - return cwd -} -try { - process.cwd() -} catch (er) {} +"use strict"; -var chdir = process.chdir -process.chdir = function(d) { - cwd = null - chdir.call(process, d) -} -module.exports = patch +const processFn = (fn, options) => function (...args) { + const P = options.promiseModule; -function patch (fs) { - // (re-)implement some things that are known busted or missing. + return new P((resolve, reject) => { + if (options.multiArgs) { + args.push((...result) => { + if (options.errorFirst) { + if (result[0]) { + reject(result); + } else { + result.shift(); + resolve(result); + } + } else { + resolve(result); + } + }); + } else if (options.errorFirst) { + args.push((error, result) => { + if (error) { + reject(error); + } else { + resolve(result); + } + }); + } else { + args.push(resolve); + } - // lchmod, broken prior to 0.6.2 - // back-port the fix here. - if (constants.hasOwnProperty('O_SYMLINK') && - process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs) - } + fn.apply(this, args); + }); +}; - // lutimes implementation, or no-op - if (!fs.lutimes) { - patchLutimes(fs) - } +module.exports = (input, options) => { + options = Object.assign({ + exclude: [/.+(Sync|Stream)$/], + errorFirst: true, + promiseModule: Promise + }, options); - // https://github.com/isaacs/node-graceful-fs/issues/4 - // Chown should not fail on einval or eperm if non-root. - // It should not fail on enosys ever, as this just indicates - // that a fs doesn't support the intended operation. + const objType = typeof input; + if (!(input !== null && (objType === 'object' || objType === 'function'))) { + throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${input === null ? 'null' : objType}\``); + } - fs.chown = chownFix(fs.chown) - fs.fchown = chownFix(fs.fchown) - fs.lchown = chownFix(fs.lchown) + const filter = key => { + const match = pattern => typeof pattern === 'string' ? key === pattern : pattern.test(key); + return options.include ? options.include.some(match) : !options.exclude.some(match); + }; - fs.chmod = chmodFix(fs.chmod) - fs.fchmod = chmodFix(fs.fchmod) - fs.lchmod = chmodFix(fs.lchmod) + let ret; + if (objType === 'function') { + ret = function (...args) { + return options.excludeMain ? input(...args) : processFn(input, options).apply(this, args); + }; + } else { + ret = Object.create(Object.getPrototypeOf(input)); + } - fs.chownSync = chownFixSync(fs.chownSync) - fs.fchownSync = chownFixSync(fs.fchownSync) - fs.lchownSync = chownFixSync(fs.lchownSync) + for (const key in input) { // eslint-disable-line guard-for-in + const property = input[key]; + ret[key] = typeof property === 'function' && filter(key) ? processFn(property, options) : property; + } - fs.chmodSync = chmodFixSync(fs.chmodSync) - fs.fchmodSync = chmodFixSync(fs.fchmodSync) - fs.lchmodSync = chmodFixSync(fs.lchmodSync) + return ret; +}; - fs.stat = statFix(fs.stat) - fs.fstat = statFix(fs.fstat) - fs.lstat = statFix(fs.lstat) - fs.statSync = statFixSync(fs.statSync) - fs.fstatSync = statFixSync(fs.fstatSync) - fs.lstatSync = statFixSync(fs.lstatSync) +/***/ }), +/* 232 */ +/***/ (function(module, exports, __webpack_require__) { - // if lchmod/lchown do not exist, then make them no-ops - if (!fs.lchmod) { - fs.lchmod = function (path, mode, cb) { - if (cb) process.nextTick(cb) - } - fs.lchmodSync = function () {} - } - if (!fs.lchown) { - fs.lchown = function (path, uid, gid, cb) { - if (cb) process.nextTick(cb) - } - fs.lchownSync = function () {} - } +"use strict"; - // on Windows, A/V software can lock the directory, causing this - // to fail with an EACCES or EPERM if the directory contains newly - // created files. Try again on failure, for up to 60 seconds. - // Set the timeout this long because some Windows Anti-Virus, such as Parity - // bit9, may lock files for up to a minute, causing npm package install - // failures. Also, take care to yield the scheduler. Windows scheduling gives - // CPU to a busy looping process, which can cause the program causing the lock - // contention to be starved of CPU by node, so the contention doesn't resolve. - if (platform === "win32") { - fs.rename = (function (fs$rename) { return function (from, to, cb) { - var start = Date.now() - var backoff = 0; - fs$rename(from, to, function CB (er) { - if (er - && (er.code === "EACCES" || er.code === "EPERM") - && Date.now() - start < 60000) { - setTimeout(function() { - fs.stat(to, function (stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er) - }) - }, backoff) - if (backoff < 100) - backoff += 10; - return; - } - if (cb) cb(er) - }) - }})(fs.rename) - } +// detect either spaces or tabs but not both to properly handle tabs +// for indentation and spaces for alignment +const INDENT_RE = /^(?:( )+|\t+)/; - // if read() returns EAGAIN, then just try it again. - fs.read = (function (fs$read) { return function (fd, buffer, offset, length, position, callback_) { - var callback - if (callback_ && typeof callback_ === 'function') { - var eagCounter = 0 - callback = function (er, _, __) { - if (er && er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - callback_.apply(this, arguments) - } - } - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - }})(fs.read) +function getMostUsed(indents) { + let result = 0; + let maxUsed = 0; + let maxWeight = 0; - fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { - var eagCounter = 0 - while (true) { - try { - return fs$readSync.call(fs, fd, buffer, offset, length, position) - } catch (er) { - if (er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - continue - } - throw er - } - } - }})(fs.readSync) + for (const entry of indents) { + // TODO: use destructuring when targeting Node.js 6 + const key = entry[0]; + const val = entry[1]; - function patchLchmod (fs) { - fs.lchmod = function (path, mode, callback) { - fs.open( path - , constants.O_WRONLY | constants.O_SYMLINK - , mode - , function (err, fd) { - if (err) { - if (callback) callback(err) - return - } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - fs.fchmod(fd, mode, function (err) { - fs.close(fd, function(err2) { - if (callback) callback(err || err2) - }) - }) - }) - } + const u = val[0]; + const w = val[1]; - fs.lchmodSync = function (path, mode) { - var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + if (u > maxUsed || (u === maxUsed && w > maxWeight)) { + maxUsed = u; + maxWeight = w; + result = Number(key); + } + } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - var threw = true - var ret - try { - ret = fs.fchmodSync(fd, mode) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } - } + return result; +} - function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK")) { - fs.lutimes = function (path, at, mt, cb) { - fs.open(path, constants.O_SYMLINK, function (er, fd) { - if (er) { - if (cb) cb(er) - return - } - fs.futimes(fd, at, mt, function (er) { - fs.close(fd, function (er2) { - if (cb) cb(er || er2) - }) - }) - }) - } +module.exports = str => { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } - fs.lutimesSync = function (path, at, mt) { - var fd = fs.openSync(path, constants.O_SYMLINK) - var ret - var threw = true - try { - ret = fs.futimesSync(fd, at, mt) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } + // used to see if tabs or spaces are the most used + let tabs = 0; + let spaces = 0; - } else { - fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } - fs.lutimesSync = function () {} - } - } + // remember the size of previous line's indentation + let prev = 0; - function chmodFix (orig) { - if (!orig) return orig - return function (target, mode, cb) { - return orig.call(fs, target, mode, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } + // remember how many indents/unindents as occurred for a given size + // and how much lines follow a given indentation + // + // indents = { + // 3: [1, 0], + // 4: [1, 5], + // 5: [1, 0], + // 12: [1, 0], + // } + const indents = new Map(); - function chmodFixSync (orig) { - if (!orig) return orig - return function (target, mode) { - try { - return orig.call(fs, target, mode) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } + // pointer to the array of last used indent + let current; + // whether the last action was an indent (opposed to an unindent) + let isIndent; - function chownFix (orig) { - if (!orig) return orig - return function (target, uid, gid, cb) { - return orig.call(fs, target, uid, gid, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } + for (const line of str.split(/\n/g)) { + if (!line) { + // ignore empty lines + continue; + } - function chownFixSync (orig) { - if (!orig) return orig - return function (target, uid, gid) { - try { - return orig.call(fs, target, uid, gid) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } + let indent; + const matches = line.match(INDENT_RE); + if (matches) { + indent = matches[0].length; - function statFix (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, cb) { - return orig.call(fs, target, function (er, stats) { - if (!stats) return cb.apply(this, arguments) - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - if (cb) cb.apply(this, arguments) - }) - } - } + if (matches[1]) { + spaces++; + } else { + tabs++; + } + } else { + indent = 0; + } - function statFixSync (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target) { - var stats = orig.call(fs, target) - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - return stats; - } - } + const diff = indent - prev; + prev = indent; - // ENOSYS means that the fs doesn't support the op. Just ignore - // that, because it doesn't matter. - // - // if there's no getuid, or if getuid() is something other - // than 0, and the error is EINVAL or EPERM, then just ignore - // it. - // - // This specific case is a silent failure in cp, install, tar, - // and most other unix tools that manage permissions. - // - // When running as root, or if other types of errors are - // encountered, then it's strict. - function chownErOk (er) { - if (!er) - return true + if (diff) { + // an indent or unindent has been detected - if (er.code === "ENOSYS") - return true + isIndent = diff > 0; - var nonroot = !process.getuid || process.getuid() !== 0 - if (nonroot) { - if (er.code === "EINVAL" || er.code === "EPERM") - return true - } + current = indents.get(isIndent ? diff : -diff); - return false - } -} + if (current) { + current[0]++; + } else { + current = [1, 0]; + indents.set(diff, current); + } + } else if (current) { + // if the last action was an indent, increment the weight + current[1] += Number(isIndent); + } + } + const amount = getMostUsed(indents); -/***/ }), -/* 210 */ -/***/ (function(module, exports, __webpack_require__) { + let type; + let indent; + if (!amount) { + type = null; + indent = ''; + } else if (spaces >= tabs) { + type = 'space'; + indent = ' '.repeat(amount); + } else { + type = 'tab'; + indent = '\t'.repeat(amount); + } -var Stream = __webpack_require__(136).Stream + return { + amount, + type, + indent + }; +}; -module.exports = legacy -function legacy (fs) { - return { - ReadStream: ReadStream, - WriteStream: WriteStream - } +/***/ }), +/* 233 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - function ReadStream (path, options) { - if (!(this instanceof ReadStream)) return new ReadStream(path, options); +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "installInDir", function() { return installInDir; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runScriptInPackage", function() { return runScriptInPackage; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runScriptInPackageStreaming", function() { return runScriptInPackageStreaming; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "yarnWorkspacesInfo", function() { return yarnWorkspacesInfo; }); +/* harmony import */ var _child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(234); +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ - Stream.call(this); +const YARN_EXEC = process.env.npm_execpath || 'yarn'; - var self = this; +/** + * Install all dependencies in the given directory + */ +async function installInDir(directory, extraArgs = []) { + const options = ['install', '--non-interactive', ...extraArgs]; // We pass the mutex flag to ensure only one instance of yarn runs at any + // given time (e.g. to avoid conflicts). - this.path = path; - this.fd = null; - this.readable = true; - this.paused = false; + await Object(_child_process__WEBPACK_IMPORTED_MODULE_0__["spawn"])(YARN_EXEC, options, { + cwd: directory + }); +} +/** + * Run script in the given directory + */ - this.flags = 'r'; - this.mode = 438; /*=0666*/ - this.bufferSize = 64 * 1024; +async function runScriptInPackage(script, args, pkg) { + const execOpts = { + cwd: pkg.path + }; + await Object(_child_process__WEBPACK_IMPORTED_MODULE_0__["spawn"])(YARN_EXEC, ['run', script, ...args], execOpts); +} +/** + * Run script in the given directory + */ - options = options || {}; +function runScriptInPackageStreaming({ + script, + args, + pkg, + debug +}) { + const execOpts = { + cwd: pkg.path + }; + return Object(_child_process__WEBPACK_IMPORTED_MODULE_0__["spawnStreaming"])(YARN_EXEC, ['run', script, ...args], execOpts, { + prefix: pkg.name, + debug + }); +} +async function yarnWorkspacesInfo(directory) { + const { + stdout + } = await Object(_child_process__WEBPACK_IMPORTED_MODULE_0__["spawn"])(YARN_EXEC, ['--json', 'workspaces', 'info'], { + cwd: directory, + stdio: 'pipe' + }); - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } + try { + return JSON.parse(JSON.parse(stdout).data); + } catch (error) { + throw new Error(`'yarn workspaces info --json' produced unexpected output: \n${stdout}`); + } +} - if (this.encoding) this.setEncoding(this.encoding); +/***/ }), +/* 234 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.end === undefined) { - this.end = Infinity; - } else if ('number' !== typeof this.end) { - throw TypeError('end must be a Number'); - } +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "spawn", function() { return spawn; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "spawnStreaming", function() { return spawnStreaming; }); +/* harmony import */ var stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(137); +/* harmony import */ var stream__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(stream__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(235); +/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var execa__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(244); +/* harmony import */ var execa__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(execa__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var strong_log_transformer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(279); +/* harmony import */ var strong_log_transformer__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(strong_log_transformer__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(143); +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - if (this.start > this.end) { - throw new Error('start must be <= end'); - } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - this.pos = this.start; - } +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - if (this.fd !== null) { - process.nextTick(function() { - self._read(); - }); - return; - } +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ - fs.open(this.path, this.flags, this.mode, function (err, fd) { - if (err) { - self.emit('error', err); - self.readable = false; - return; - } - self.fd = fd; - self.emit('open', fd); - self._read(); - }) - } - function WriteStream (path, options) { - if (!(this instanceof WriteStream)) return new WriteStream(path, options); - Stream.call(this); - this.path = path; - this.fd = null; - this.writable = true; +const colorWheel = [chalk__WEBPACK_IMPORTED_MODULE_1___default.a.cyan, chalk__WEBPACK_IMPORTED_MODULE_1___default.a.magenta, chalk__WEBPACK_IMPORTED_MODULE_1___default.a.blue, chalk__WEBPACK_IMPORTED_MODULE_1___default.a.yellow, chalk__WEBPACK_IMPORTED_MODULE_1___default.a.green]; - this.flags = 'w'; - this.encoding = 'binary'; - this.mode = 438; /*=0666*/ - this.bytesWritten = 0; +const getColor = () => { + const color = colorWheel.shift(); + colorWheel.push(color); + return color; +}; - options = options || {}; +function spawn(command, args, opts) { + return execa__WEBPACK_IMPORTED_MODULE_2___default()(command, args, _objectSpread({ + stdio: 'inherit', + preferLocal: true + }, opts)); +} - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } +function streamToLog(debug = true) { + return new stream__WEBPACK_IMPORTED_MODULE_0__["Writable"]({ + objectMode: true, - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.start < 0) { - throw new Error('start must be >= zero'); + write(line, _, cb) { + if (line.endsWith('\n')) { + _log__WEBPACK_IMPORTED_MODULE_4__["log"][debug ? 'debug' : 'write'](line.slice(0, -1)); + } else { + _log__WEBPACK_IMPORTED_MODULE_4__["log"][debug ? 'debug' : 'write'](line); } - this.pos = this.start; + cb(); } - this.busy = false; - this._queue = []; - - if (this.fd === null) { - this._open = fs.open; - this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); - this.flush(); - } - } + }); } +function spawnStreaming(command, args, opts, { + prefix, + debug +}) { + const spawned = execa__WEBPACK_IMPORTED_MODULE_2___default()(command, args, _objectSpread({ + stdio: ['ignore', 'pipe', 'pipe'], + preferLocal: true + }, opts)); + const color = getColor(); + const prefixedStdout = strong_log_transformer__WEBPACK_IMPORTED_MODULE_3___default()({ + tag: color.bold(prefix) + }); + const prefixedStderr = strong_log_transformer__WEBPACK_IMPORTED_MODULE_3___default()({ + mergeMultiline: true, + tag: color.bold(prefix) + }); + spawned.stdout.pipe(prefixedStdout).pipe(streamToLog(debug)); + spawned.stderr.pipe(prefixedStderr).pipe(streamToLog(debug)); + return spawned; +} /***/ }), -/* 211 */ +/* 235 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +const ansiStyles = __webpack_require__(236); +const {stdout: stdoutColor, stderr: stderrColor} = __webpack_require__(240); +const { + stringReplaceAll, + stringEncaseCRLFWithFirstIndex +} = __webpack_require__(242); -module.exports = clone +const {isArray} = Array; -function clone (obj) { - if (obj === null || typeof obj !== 'object') - return obj +// `supportsColor.level` → `ansiStyles.color[name]` mapping +const levelMapping = [ + 'ansi', + 'ansi', + 'ansi256', + 'ansi16m' +]; - if (obj instanceof Object) - var copy = { __proto__: obj.__proto__ } - else - var copy = Object.create(null) +const styles = Object.create(null); - Object.getOwnPropertyNames(obj).forEach(function (key) { - Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) - }) +const applyOptions = (object, options = {}) => { + if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) { + throw new Error('The `level` option should be an integer from 0 to 3'); + } - return copy + // Detect level if not set manually + const colorLevel = stdoutColor ? stdoutColor.level : 0; + object.level = options.level === undefined ? colorLevel : options.level; +}; + +class ChalkClass { + constructor(options) { + // eslint-disable-next-line no-constructor-return + return chalkFactory(options); + } } +const chalkFactory = options => { + const chalk = {}; + applyOptions(chalk, options); -/***/ }), -/* 212 */ -/***/ (function(module, exports, __webpack_require__) { + chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_); -"use strict"; + Object.setPrototypeOf(chalk, Chalk.prototype); + Object.setPrototypeOf(chalk.template, chalk); -module.exports = writeFile -module.exports.sync = writeFileSync -module.exports._getTmpname = getTmpname // for testing -module.exports._cleanupOnExit = cleanupOnExit + chalk.template.constructor = () => { + throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.'); + }; -var fs = __webpack_require__(213) -var MurmurHash3 = __webpack_require__(217) -var onExit = __webpack_require__(218) -var path = __webpack_require__(4) -var activeFiles = {} + chalk.template.Instance = ChalkClass; -// if we run inside of a worker_thread, `process.pid` is not unique -/* istanbul ignore next */ -var threadId = (function getId () { - try { - var workerThreads = __webpack_require__(220) + return chalk.template; +}; - /// if we are in main thread, this is set to `0` - return workerThreads.threadId - } catch (e) { - // worker_threads are not available, fallback to 0 - return 0 - } -})() +function Chalk(options) { + return chalkFactory(options); +} -var invocations = 0 -function getTmpname (filename) { - return filename + '.' + - MurmurHash3(__filename) - .hash(String(process.pid)) - .hash(String(threadId)) - .hash(String(++invocations)) - .result() +for (const [styleName, style] of Object.entries(ansiStyles)) { + styles[styleName] = { + get() { + const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty); + Object.defineProperty(this, styleName, {value: builder}); + return builder; + } + }; } -function cleanupOnExit (tmpfile) { - return function () { - try { - fs.unlinkSync(typeof tmpfile === 'function' ? tmpfile() : tmpfile) - } catch (_) {} - } +styles.visible = { + get() { + const builder = createBuilder(this, this._styler, true); + Object.defineProperty(this, 'visible', {value: builder}); + return builder; + } +}; + +const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256']; + +for (const model of usedModels) { + styles[model] = { + get() { + const {level} = this; + return function (...arguments_) { + const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler); + return createBuilder(this, styler, this._isEmpty); + }; + } + }; } -function writeFile (filename, data, options, callback) { - if (options) { - if (options instanceof Function) { - callback = options - options = {} - } else if (typeof options === 'string') { - options = { encoding: options } - } - } else { - options = {} - } +for (const model of usedModels) { + const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); + styles[bgModel] = { + get() { + const {level} = this; + return function (...arguments_) { + const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler); + return createBuilder(this, styler, this._isEmpty); + }; + } + }; +} + +const proto = Object.defineProperties(() => {}, { + ...styles, + level: { + enumerable: true, + get() { + return this._generator.level; + }, + set(level) { + this._generator.level = level; + } + } +}); + +const createStyler = (open, close, parent) => { + let openAll; + let closeAll; + if (parent === undefined) { + openAll = open; + closeAll = close; + } else { + openAll = parent.openAll + open; + closeAll = close + parent.closeAll; + } + + return { + open, + close, + openAll, + closeAll, + parent + }; +}; + +const createBuilder = (self, _styler, _isEmpty) => { + const builder = (...arguments_) => { + if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) { + // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}` + return applyStyle(builder, chalkTag(builder, ...arguments_)); + } + + // Single argument is hot path, implicit coercion is faster than anything + // eslint-disable-next-line no-implicit-coercion + return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' ')); + }; + + // We alter the prototype because we must return a function, but there is + // no way to create a function with a different prototype + Object.setPrototypeOf(builder, proto); + + builder._generator = self; + builder._styler = _styler; + builder._isEmpty = _isEmpty; + + return builder; +}; + +const applyStyle = (self, string) => { + if (self.level <= 0 || !string) { + return self._isEmpty ? '' : string; + } + + let styler = self._styler; + + if (styler === undefined) { + return string; + } + + const {openAll, closeAll} = styler; + if (string.indexOf('\u001B') !== -1) { + while (styler !== undefined) { + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + string = stringReplaceAll(string, styler.close, styler.open); + + styler = styler.parent; + } + } - var Promise = options.Promise || global.Promise - var truename - var fd - var tmpfile - /* istanbul ignore next -- The closure only gets called when onExit triggers */ - var removeOnExitHandler = onExit(cleanupOnExit(() => tmpfile)) - var absoluteName = path.resolve(filename) + // We can move both next actions out of loop, because remaining actions in loop won't have + // any/visible effect on parts we add here. Close the styling before a linebreak and reopen + // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92 + const lfIndex = string.indexOf('\n'); + if (lfIndex !== -1) { + string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex); + } - new Promise(function serializeSameFile (resolve) { - // make a queue if it doesn't already exist - if (!activeFiles[absoluteName]) activeFiles[absoluteName] = [] + return openAll + string + closeAll; +}; - activeFiles[absoluteName].push(resolve) // add this job to the queue - if (activeFiles[absoluteName].length === 1) resolve() // kick off the first one - }).then(function getRealPath () { - return new Promise(function (resolve) { - fs.realpath(filename, function (_, realname) { - truename = realname || filename - tmpfile = getTmpname(truename) - resolve() - }) - }) - }).then(function stat () { - return new Promise(function stat (resolve) { - if (options.mode && options.chown) resolve() - else { - // Either mode or chown is not explicitly set - // Default behavior is to copy it from original file - fs.stat(truename, function (err, stats) { - if (err || !stats) resolve() - else { - options = Object.assign({}, options) +let template; +const chalkTag = (chalk, ...strings) => { + const [firstString] = strings; - if (options.mode == null) { - options.mode = stats.mode - } - if (options.chown == null && process.getuid) { - options.chown = { uid: stats.uid, gid: stats.gid } - } - resolve() - } - }) - } - }) - }).then(function thenWriteFile () { - return new Promise(function (resolve, reject) { - fs.open(tmpfile, 'w', options.mode, function (err, _fd) { - fd = _fd - if (err) reject(err) - else resolve() - }) - }) - }).then(function write () { - return new Promise(function (resolve, reject) { - if (Buffer.isBuffer(data)) { - fs.write(fd, data, 0, data.length, 0, function (err) { - if (err) reject(err) - else resolve() - }) - } else if (data != null) { - fs.write(fd, String(data), 0, String(options.encoding || 'utf8'), function (err) { - if (err) reject(err) - else resolve() - }) - } else resolve() - }) - }).then(function syncAndClose () { - return new Promise(function (resolve, reject) { - if (options.fsync !== false) { - fs.fsync(fd, function (err) { - if (err) fs.close(fd, () => reject(err)) - else fs.close(fd, resolve) - }) - } else { - fs.close(fd, resolve) - } - }) - }).then(function chown () { - fd = null - if (options.chown) { - return new Promise(function (resolve, reject) { - fs.chown(tmpfile, options.chown.uid, options.chown.gid, function (err) { - if (err) reject(err) - else resolve() - }) - }) - } - }).then(function chmod () { - if (options.mode) { - return new Promise(function (resolve, reject) { - fs.chmod(tmpfile, options.mode, function (err) { - if (err) reject(err) - else resolve() - }) - }) - } - }).then(function rename () { - return new Promise(function (resolve, reject) { - fs.rename(tmpfile, truename, function (err) { - if (err) reject(err) - else resolve() - }) - }) - }).then(function success () { - removeOnExitHandler() - callback() - }, function fail (err) { - return new Promise(resolve => { - return fd ? fs.close(fd, resolve) : resolve() - }).then(() => { - removeOnExitHandler() - fs.unlink(tmpfile, function () { - callback(err) - }) - }) - }).then(function checkQueue () { - activeFiles[absoluteName].shift() // remove the element added by serializeSameFile - if (activeFiles[absoluteName].length > 0) { - activeFiles[absoluteName][0]() // start next job if one is pending - } else delete activeFiles[absoluteName] - }) -} + if (!isArray(firstString) || !isArray(firstString.raw)) { + // If chalk() was called by itself or with a string, + // return the string itself as a string. + return strings.join(' '); + } -function writeFileSync (filename, data, options) { - if (typeof options === 'string') options = { encoding: options } - else if (!options) options = {} - try { - filename = fs.realpathSync(filename) - } catch (ex) { - // it's ok, it'll happen on a not yet existing file - } - var tmpfile = getTmpname(filename) + const arguments_ = strings.slice(1); + const parts = [firstString.raw[0]]; - if (!options.mode || !options.chown) { - // Either mode or chown is not explicitly set - // Default behavior is to copy it from original file - try { - var stats = fs.statSync(filename) - options = Object.assign({}, options) - if (!options.mode) { - options.mode = stats.mode - } - if (!options.chown && process.getuid) { - options.chown = { uid: stats.uid, gid: stats.gid } - } - } catch (ex) { - // ignore stat errors - } - } + for (let i = 1; i < firstString.length; i++) { + parts.push( + String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), + String(firstString.raw[i]) + ); + } - var fd - var cleanup = cleanupOnExit(tmpfile) - var removeOnExitHandler = onExit(cleanup) + if (template === undefined) { + template = __webpack_require__(243); + } - try { - fd = fs.openSync(tmpfile, 'w', options.mode) - if (Buffer.isBuffer(data)) { - fs.writeSync(fd, data, 0, data.length, 0) - } else if (data != null) { - fs.writeSync(fd, String(data), 0, String(options.encoding || 'utf8')) - } - if (options.fsync !== false) { - fs.fsyncSync(fd) - } - fs.closeSync(fd) - if (options.chown) fs.chownSync(tmpfile, options.chown.uid, options.chown.gid) - if (options.mode) fs.chmodSync(tmpfile, options.mode) - fs.renameSync(tmpfile, filename) - removeOnExitHandler() - } catch (err) { - if (fd) { - try { - fs.closeSync(fd) - } catch (ex) { - // ignore close errors at this stage, error may have closed fd already. - } - } - removeOnExitHandler() - cleanup() - throw err - } -} + return template(chalk, parts.join('')); +}; + +Object.defineProperties(Chalk.prototype, styles); + +const chalk = Chalk(); // eslint-disable-line new-cap +chalk.supportsColor = stdoutColor; +chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap +chalk.stderr.supportsColor = stderrColor; + +module.exports = chalk; /***/ }), -/* 213 */ +/* 236 */ /***/ (function(module, exports, __webpack_require__) { -var fs = __webpack_require__(132) -var polyfills = __webpack_require__(214) -var legacy = __webpack_require__(216) -var queue = [] +"use strict"; +/* WEBPACK VAR INJECTION */(function(module) { -var util = __webpack_require__(111) +const wrapAnsi16 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${code + offset}m`; +}; -function noop () {} +const wrapAnsi256 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${38 + offset};5;${code}m`; +}; -var debug = noop -if (util.debuglog) - debug = util.debuglog('gfs4') -else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) - debug = function() { - var m = util.format.apply(util, arguments) - m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') - console.error(m) - } +const wrapAnsi16m = (fn, offset) => (...args) => { + const rgb = fn(...args); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; +}; -if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { - process.on('exit', function() { - debug(queue) - __webpack_require__(138).equal(queue.length, 0) - }) -} +const ansi2ansi = n => n; +const rgb2rgb = (r, g, b) => [r, g, b]; -module.exports = patch(__webpack_require__(215)) -if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH) { - module.exports = patch(fs) -} +const setLazyProperty = (object, property, get) => { + Object.defineProperty(object, property, { + get: () => { + const value = get(); -// Always patch fs.close/closeSync, because we want to -// retry() whenever a close happens *anywhere* in the program. -// This is essential when multiple graceful-fs instances are -// in play at the same time. -module.exports.close = -fs.close = (function (fs$close) { return function (fd, cb) { - return fs$close.call(fs, fd, function (err) { - if (!err) - retry() + Object.defineProperty(object, property, { + value, + enumerable: true, + configurable: true + }); - if (typeof cb === 'function') - cb.apply(this, arguments) - }) -}})(fs.close) + return value; + }, + enumerable: true, + configurable: true + }); +}; -module.exports.closeSync = -fs.closeSync = (function (fs$closeSync) { return function (fd) { - // Note that graceful-fs also retries when fs.closeSync() fails. - // Looks like a bug to me, although it's probably a harmless one. - var rval = fs$closeSync.apply(fs, arguments) - retry() - return rval -}})(fs.closeSync) +/** @type {typeof import('color-convert')} */ +let colorConvert; +const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { + if (colorConvert === undefined) { + colorConvert = __webpack_require__(237); + } -function patch (fs) { - // Everything that references the open() function needs to be in here - polyfills(fs) - fs.gracefulify = patch - fs.FileReadStream = ReadStream; // Legacy name. - fs.FileWriteStream = WriteStream; // Legacy name. - fs.createReadStream = createReadStream - fs.createWriteStream = createWriteStream - var fs$readFile = fs.readFile - fs.readFile = readFile - function readFile (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null + const offset = isBackground ? 10 : 0; + const styles = {}; - return go$readFile(path, options, cb) + for (const [sourceSpace, suite] of Object.entries(colorConvert)) { + const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; + if (sourceSpace === targetSpace) { + styles[name] = wrap(identity, offset); + } else if (typeof suite === 'object') { + styles[name] = wrap(suite[targetSpace], offset); + } + } - function go$readFile (path, options, cb) { - return fs$readFile(path, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readFile, [path, options, cb]]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - }) - } - } + return styles; +}; - var fs$writeFile = fs.writeFile - fs.writeFile = writeFile - function writeFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], - return go$writeFile(path, data, options, cb) + // Bright color + blackBright: [90, 39], + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], - function go$writeFile (path, data, options, cb) { - return fs$writeFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$writeFile, [path, data, options, cb]]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - }) - } - } + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; - var fs$appendFile = fs.appendFile - if (fs$appendFile) - fs.appendFile = appendFile - function appendFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null + // Alias bright black as gray (and grey) + styles.color.gray = styles.color.blackBright; + styles.bgColor.bgGray = styles.bgColor.bgBlackBright; + styles.color.grey = styles.color.blackBright; + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; - return go$appendFile(path, data, options, cb) + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; - function go$appendFile (path, data, options, cb) { - return fs$appendFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$appendFile, [path, data, options, cb]]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - }) - } - } + group[styleName] = styles[styleName]; - var fs$readdir = fs.readdir - fs.readdir = readdir - function readdir (path, options, cb) { - var args = [path] - if (typeof options !== 'function') { - args.push(options) - } else { - cb = options - } - args.push(go$readdir$cb) + codes.set(style[0], style[1]); + } - return go$readdir(args) + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + } - function go$readdir$cb (err, files) { - if (files && files.sort) - files.sort() + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readdir, [args]]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - } - } + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; - function go$readdir (args) { - return fs$readdir.apply(fs, args) - } + setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); + setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); - if (process.version.substr(0, 4) === 'v0.8') { - var legStreams = legacy(fs) - ReadStream = legStreams.ReadStream - WriteStream = legStreams.WriteStream - } + return styles; +} - var fs$ReadStream = fs.ReadStream - ReadStream.prototype = Object.create(fs$ReadStream.prototype) - ReadStream.prototype.open = ReadStream$open +// Make the export immutable +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles +}); - var fs$WriteStream = fs.WriteStream - WriteStream.prototype = Object.create(fs$WriteStream.prototype) - WriteStream.prototype.open = WriteStream$open +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(114)(module))) - fs.ReadStream = ReadStream - fs.WriteStream = WriteStream +/***/ }), +/* 237 */ +/***/ (function(module, exports, __webpack_require__) { - function ReadStream (path, options) { - if (this instanceof ReadStream) - return fs$ReadStream.apply(this, arguments), this - else - return ReadStream.apply(Object.create(ReadStream.prototype), arguments) - } +const conversions = __webpack_require__(238); +const route = __webpack_require__(239); - function ReadStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - if (that.autoClose) - that.destroy() +const convert = {}; - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - that.read() - } - }) - } +const models = Object.keys(conversions); - function WriteStream (path, options) { - if (this instanceof WriteStream) - return fs$WriteStream.apply(this, arguments), this - else - return WriteStream.apply(Object.create(WriteStream.prototype), arguments) - } +function wrapRaw(fn) { + const wrappedFn = function (...args) { + const arg0 = args[0]; + if (arg0 === undefined || arg0 === null) { + return arg0; + } - function WriteStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - that.destroy() - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - } - }) - } + if (arg0.length > 1) { + args = arg0; + } - function createReadStream (path, options) { - return new ReadStream(path, options) - } + return fn(args); + }; - function createWriteStream (path, options) { - return new WriteStream(path, options) - } + // Preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } - var fs$open = fs.open - fs.open = open - function open (path, flags, mode, cb) { - if (typeof mode === 'function') - cb = mode, mode = null + return wrappedFn; +} + +function wrapRounded(fn) { + const wrappedFn = function (...args) { + const arg0 = args[0]; + + if (arg0 === undefined || arg0 === null) { + return arg0; + } + + if (arg0.length > 1) { + args = arg0; + } + + const result = fn(args); + + // We're assuming the result is an array here. + // see notice in conversions.js; don't use box types + // in conversion functions. + if (typeof result === 'object') { + for (let len = result.length, i = 0; i < len; i++) { + result[i] = Math.round(result[i]); + } + } + + return result; + }; + + // Preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } - return go$open(path, flags, mode, cb) + return wrappedFn; +} - function go$open (path, flags, mode, cb) { - return fs$open(path, flags, mode, function (err, fd) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$open, [path, flags, mode, cb]]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - }) - } - } +models.forEach(fromModel => { + convert[fromModel] = {}; - return fs -} + Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); + Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); -function enqueue (elem) { - debug('ENQUEUE', elem[0].name, elem[1]) - queue.push(elem) -} + const routes = route(fromModel); + const routeModels = Object.keys(routes); -function retry () { - var elem = queue.shift() - if (elem) { - debug('RETRY', elem[0].name, elem[1]) - elem[0].apply(null, elem[1]) - } -} + routeModels.forEach(toModel => { + const fn = routes[toModel]; + + convert[fromModel][toModel] = wrapRounded(fn); + convert[fromModel][toModel].raw = wrapRaw(fn); + }); +}); + +module.exports = convert; /***/ }), -/* 214 */ +/* 238 */ /***/ (function(module, exports, __webpack_require__) { -var fs = __webpack_require__(215) -var constants = __webpack_require__(134) - -var origCwd = process.cwd -var cwd = null - -var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform +/* MIT license */ +/* eslint-disable no-mixed-operators */ +const cssKeywords = __webpack_require__(117); -process.cwd = function() { - if (!cwd) - cwd = origCwd.call(process) - return cwd -} -try { - process.cwd() -} catch (er) {} +// NOTE: conversions should only return primitive values (i.e. arrays, or +// values that give correct `typeof` results). +// do not use box values types (i.e. Number(), String(), etc.) -var chdir = process.chdir -process.chdir = function(d) { - cwd = null - chdir.call(process, d) +const reverseKeywords = {}; +for (const key of Object.keys(cssKeywords)) { + reverseKeywords[cssKeywords[key]] = key; } -module.exports = patch +const convert = { + rgb: {channels: 3, labels: 'rgb'}, + hsl: {channels: 3, labels: 'hsl'}, + hsv: {channels: 3, labels: 'hsv'}, + hwb: {channels: 3, labels: 'hwb'}, + cmyk: {channels: 4, labels: 'cmyk'}, + xyz: {channels: 3, labels: 'xyz'}, + lab: {channels: 3, labels: 'lab'}, + lch: {channels: 3, labels: 'lch'}, + hex: {channels: 1, labels: ['hex']}, + keyword: {channels: 1, labels: ['keyword']}, + ansi16: {channels: 1, labels: ['ansi16']}, + ansi256: {channels: 1, labels: ['ansi256']}, + hcg: {channels: 3, labels: ['h', 'c', 'g']}, + apple: {channels: 3, labels: ['r16', 'g16', 'b16']}, + gray: {channels: 1, labels: ['gray']} +}; -function patch (fs) { - // (re-)implement some things that are known busted or missing. +module.exports = convert; - // lchmod, broken prior to 0.6.2 - // back-port the fix here. - if (constants.hasOwnProperty('O_SYMLINK') && - process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs) - } +// Hide .channels and .labels properties +for (const model of Object.keys(convert)) { + if (!('channels' in convert[model])) { + throw new Error('missing channels property: ' + model); + } - // lutimes implementation, or no-op - if (!fs.lutimes) { - patchLutimes(fs) - } + if (!('labels' in convert[model])) { + throw new Error('missing channel labels property: ' + model); + } - // https://github.com/isaacs/node-graceful-fs/issues/4 - // Chown should not fail on einval or eperm if non-root. - // It should not fail on enosys ever, as this just indicates - // that a fs doesn't support the intended operation. + if (convert[model].labels.length !== convert[model].channels) { + throw new Error('channel and label counts mismatch: ' + model); + } - fs.chown = chownFix(fs.chown) - fs.fchown = chownFix(fs.fchown) - fs.lchown = chownFix(fs.lchown) + const {channels, labels} = convert[model]; + delete convert[model].channels; + delete convert[model].labels; + Object.defineProperty(convert[model], 'channels', {value: channels}); + Object.defineProperty(convert[model], 'labels', {value: labels}); +} - fs.chmod = chmodFix(fs.chmod) - fs.fchmod = chmodFix(fs.fchmod) - fs.lchmod = chmodFix(fs.lchmod) +convert.rgb.hsl = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const min = Math.min(r, g, b); + const max = Math.max(r, g, b); + const delta = max - min; + let h; + let s; - fs.chownSync = chownFixSync(fs.chownSync) - fs.fchownSync = chownFixSync(fs.fchownSync) - fs.lchownSync = chownFixSync(fs.lchownSync) + if (max === min) { + h = 0; + } else if (r === max) { + h = (g - b) / delta; + } else if (g === max) { + h = 2 + (b - r) / delta; + } else if (b === max) { + h = 4 + (r - g) / delta; + } - fs.chmodSync = chmodFixSync(fs.chmodSync) - fs.fchmodSync = chmodFixSync(fs.fchmodSync) - fs.lchmodSync = chmodFixSync(fs.lchmodSync) + h = Math.min(h * 60, 360); - fs.stat = statFix(fs.stat) - fs.fstat = statFix(fs.fstat) - fs.lstat = statFix(fs.lstat) + if (h < 0) { + h += 360; + } - fs.statSync = statFixSync(fs.statSync) - fs.fstatSync = statFixSync(fs.fstatSync) - fs.lstatSync = statFixSync(fs.lstatSync) + const l = (min + max) / 2; - // if lchmod/lchown do not exist, then make them no-ops - if (!fs.lchmod) { - fs.lchmod = function (path, mode, cb) { - if (cb) process.nextTick(cb) - } - fs.lchmodSync = function () {} - } - if (!fs.lchown) { - fs.lchown = function (path, uid, gid, cb) { - if (cb) process.nextTick(cb) - } - fs.lchownSync = function () {} - } + if (max === min) { + s = 0; + } else if (l <= 0.5) { + s = delta / (max + min); + } else { + s = delta / (2 - max - min); + } - // on Windows, A/V software can lock the directory, causing this - // to fail with an EACCES or EPERM if the directory contains newly - // created files. Try again on failure, for up to 60 seconds. + return [h, s * 100, l * 100]; +}; - // Set the timeout this long because some Windows Anti-Virus, such as Parity - // bit9, may lock files for up to a minute, causing npm package install - // failures. Also, take care to yield the scheduler. Windows scheduling gives - // CPU to a busy looping process, which can cause the program causing the lock - // contention to be starved of CPU by node, so the contention doesn't resolve. - if (platform === "win32") { - fs.rename = (function (fs$rename) { return function (from, to, cb) { - var start = Date.now() - var backoff = 0; - fs$rename(from, to, function CB (er) { - if (er - && (er.code === "EACCES" || er.code === "EPERM") - && Date.now() - start < 60000) { - setTimeout(function() { - fs.stat(to, function (stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er) - }) - }, backoff) - if (backoff < 100) - backoff += 10; - return; - } - if (cb) cb(er) - }) - }})(fs.rename) - } +convert.rgb.hsv = function (rgb) { + let rdif; + let gdif; + let bdif; + let h; + let s; + + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const v = Math.max(r, g, b); + const diff = v - Math.min(r, g, b); + const diffc = function (c) { + return (v - c) / 6 / diff + 1 / 2; + }; - // if read() returns EAGAIN, then just try it again. - fs.read = (function (fs$read) { return function (fd, buffer, offset, length, position, callback_) { - var callback - if (callback_ && typeof callback_ === 'function') { - var eagCounter = 0 - callback = function (er, _, __) { - if (er && er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - callback_.apply(this, arguments) - } - } - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - }})(fs.read) + if (diff === 0) { + h = 0; + s = 0; + } else { + s = diff / v; + rdif = diffc(r); + gdif = diffc(g); + bdif = diffc(b); + + if (r === v) { + h = bdif - gdif; + } else if (g === v) { + h = (1 / 3) + rdif - bdif; + } else if (b === v) { + h = (2 / 3) + gdif - rdif; + } - fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { - var eagCounter = 0 - while (true) { - try { - return fs$readSync.call(fs, fd, buffer, offset, length, position) - } catch (er) { - if (er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - continue - } - throw er - } - } - }})(fs.readSync) -} + if (h < 0) { + h += 1; + } else if (h > 1) { + h -= 1; + } + } -function patchLchmod (fs) { - fs.lchmod = function (path, mode, callback) { - fs.open( path - , constants.O_WRONLY | constants.O_SYMLINK - , mode - , function (err, fd) { - if (err) { - if (callback) callback(err) - return - } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - fs.fchmod(fd, mode, function (err) { - fs.close(fd, function(err2) { - if (callback) callback(err || err2) - }) - }) - }) - } + return [ + h * 360, + s * 100, + v * 100 + ]; +}; - fs.lchmodSync = function (path, mode) { - var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) +convert.rgb.hwb = function (rgb) { + const r = rgb[0]; + const g = rgb[1]; + let b = rgb[2]; + const h = convert.rgb.hsl(rgb)[0]; + const w = 1 / 255 * Math.min(r, Math.min(g, b)); - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - var threw = true - var ret - try { - ret = fs.fchmodSync(fd, mode) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } -} + b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); -function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK")) { - fs.lutimes = function (path, at, mt, cb) { - fs.open(path, constants.O_SYMLINK, function (er, fd) { - if (er) { - if (cb) cb(er) - return - } - fs.futimes(fd, at, mt, function (er) { - fs.close(fd, function (er2) { - if (cb) cb(er || er2) - }) - }) - }) - } + return [h, w * 100, b * 100]; +}; - fs.lutimesSync = function (path, at, mt) { - var fd = fs.openSync(path, constants.O_SYMLINK) - var ret - var threw = true - try { - ret = fs.futimesSync(fd, at, mt) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } +convert.rgb.cmyk = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; - } else { - fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } - fs.lutimesSync = function () {} - } -} + const k = Math.min(1 - r, 1 - g, 1 - b); + const c = (1 - r - k) / (1 - k) || 0; + const m = (1 - g - k) / (1 - k) || 0; + const y = (1 - b - k) / (1 - k) || 0; -function chmodFix (orig) { - if (!orig) return orig - return function (target, mode, cb) { - return orig.call(fs, target, mode, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } -} + return [c * 100, m * 100, y * 100, k * 100]; +}; -function chmodFixSync (orig) { - if (!orig) return orig - return function (target, mode) { - try { - return orig.call(fs, target, mode) - } catch (er) { - if (!chownErOk(er)) throw er - } - } +function comparativeDistance(x, y) { + /* + See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance + */ + return ( + ((x[0] - y[0]) ** 2) + + ((x[1] - y[1]) ** 2) + + ((x[2] - y[2]) ** 2) + ); } +convert.rgb.keyword = function (rgb) { + const reversed = reverseKeywords[rgb]; + if (reversed) { + return reversed; + } -function chownFix (orig) { - if (!orig) return orig - return function (target, uid, gid, cb) { - return orig.call(fs, target, uid, gid, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } -} + let currentClosestDistance = Infinity; + let currentClosestKeyword; -function chownFixSync (orig) { - if (!orig) return orig - return function (target, uid, gid) { - try { - return orig.call(fs, target, uid, gid) - } catch (er) { - if (!chownErOk(er)) throw er - } - } -} + for (const keyword of Object.keys(cssKeywords)) { + const value = cssKeywords[keyword]; + // Compute comparative distance + const distance = comparativeDistance(rgb, value); -function statFix (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, cb) { - return orig.call(fs, target, function (er, stats) { - if (!stats) return cb.apply(this, arguments) - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - if (cb) cb.apply(this, arguments) - }) - } -} + // Check if its less, if so set as closest + if (distance < currentClosestDistance) { + currentClosestDistance = distance; + currentClosestKeyword = keyword; + } + } -function statFixSync (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target) { - var stats = orig.call(fs, target) - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - return stats; - } -} + return currentClosestKeyword; +}; -// ENOSYS means that the fs doesn't support the op. Just ignore -// that, because it doesn't matter. -// -// if there's no getuid, or if getuid() is something other -// than 0, and the error is EINVAL or EPERM, then just ignore -// it. -// -// This specific case is a silent failure in cp, install, tar, -// and most other unix tools that manage permissions. -// -// When running as root, or if other types of errors are -// encountered, then it's strict. -function chownErOk (er) { - if (!er) - return true +convert.keyword.rgb = function (keyword) { + return cssKeywords[keyword]; +}; - if (er.code === "ENOSYS") - return true +convert.rgb.xyz = function (rgb) { + let r = rgb[0] / 255; + let g = rgb[1] / 255; + let b = rgb[2] / 255; - var nonroot = !process.getuid || process.getuid() !== 0 - if (nonroot) { - if (er.code === "EINVAL" || er.code === "EPERM") - return true - } + // Assume sRGB + r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92); + g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92); + b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92); - return false -} + const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); + const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); + const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); + return [x * 100, y * 100, z * 100]; +}; -/***/ }), -/* 215 */ -/***/ (function(module, exports, __webpack_require__) { +convert.rgb.lab = function (rgb) { + const xyz = convert.rgb.xyz(rgb); + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; -"use strict"; + x /= 95.047; + y /= 100; + z /= 108.883; + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); -var fs = __webpack_require__(132) + const l = (116 * y) - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); -module.exports = clone(fs) + return [l, a, b]; +}; -function clone (obj) { - if (obj === null || typeof obj !== 'object') - return obj +convert.hsl.rgb = function (hsl) { + const h = hsl[0] / 360; + const s = hsl[1] / 100; + const l = hsl[2] / 100; + let t2; + let t3; + let val; - if (obj instanceof Object) - var copy = { __proto__: obj.__proto__ } - else - var copy = Object.create(null) + if (s === 0) { + val = l * 255; + return [val, val, val]; + } - Object.getOwnPropertyNames(obj).forEach(function (key) { - Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) - }) + if (l < 0.5) { + t2 = l * (1 + s); + } else { + t2 = l + s - l * s; + } - return copy -} + const t1 = 2 * l - t2; + const rgb = [0, 0, 0]; + for (let i = 0; i < 3; i++) { + t3 = h + 1 / 3 * -(i - 1); + if (t3 < 0) { + t3++; + } -/***/ }), -/* 216 */ -/***/ (function(module, exports, __webpack_require__) { + if (t3 > 1) { + t3--; + } -var Stream = __webpack_require__(136).Stream + if (6 * t3 < 1) { + val = t1 + (t2 - t1) * 6 * t3; + } else if (2 * t3 < 1) { + val = t2; + } else if (3 * t3 < 2) { + val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; + } else { + val = t1; + } -module.exports = legacy + rgb[i] = val * 255; + } -function legacy (fs) { - return { - ReadStream: ReadStream, - WriteStream: WriteStream - } + return rgb; +}; - function ReadStream (path, options) { - if (!(this instanceof ReadStream)) return new ReadStream(path, options); +convert.hsl.hsv = function (hsl) { + const h = hsl[0]; + let s = hsl[1] / 100; + let l = hsl[2] / 100; + let smin = s; + const lmin = Math.max(l, 0.01); - Stream.call(this); + l *= 2; + s *= (l <= 1) ? l : 2 - l; + smin *= lmin <= 1 ? lmin : 2 - lmin; + const v = (l + s) / 2; + const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); - var self = this; + return [h, sv * 100, v * 100]; +}; - this.path = path; - this.fd = null; - this.readable = true; - this.paused = false; +convert.hsv.rgb = function (hsv) { + const h = hsv[0] / 60; + const s = hsv[1] / 100; + let v = hsv[2] / 100; + const hi = Math.floor(h) % 6; + + const f = h - Math.floor(h); + const p = 255 * v * (1 - s); + const q = 255 * v * (1 - (s * f)); + const t = 255 * v * (1 - (s * (1 - f))); + v *= 255; - this.flags = 'r'; - this.mode = 438; /*=0666*/ - this.bufferSize = 64 * 1024; + switch (hi) { + case 0: + return [v, t, p]; + case 1: + return [q, v, p]; + case 2: + return [p, v, t]; + case 3: + return [p, q, v]; + case 4: + return [t, p, v]; + case 5: + return [v, p, q]; + } +}; - options = options || {}; +convert.hsv.hsl = function (hsv) { + const h = hsv[0]; + const s = hsv[1] / 100; + const v = hsv[2] / 100; + const vmin = Math.max(v, 0.01); + let sl; + let l; - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } + l = (2 - s) * v; + const lmin = (2 - s) * vmin; + sl = s * vmin; + sl /= (lmin <= 1) ? lmin : 2 - lmin; + sl = sl || 0; + l /= 2; - if (this.encoding) this.setEncoding(this.encoding); + return [h, sl * 100, l * 100]; +}; - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.end === undefined) { - this.end = Infinity; - } else if ('number' !== typeof this.end) { - throw TypeError('end must be a Number'); - } +// http://dev.w3.org/csswg/css-color/#hwb-to-rgb +convert.hwb.rgb = function (hwb) { + const h = hwb[0] / 360; + let wh = hwb[1] / 100; + let bl = hwb[2] / 100; + const ratio = wh + bl; + let f; - if (this.start > this.end) { - throw new Error('start must be <= end'); - } + // Wh + bl cant be > 1 + if (ratio > 1) { + wh /= ratio; + bl /= ratio; + } - this.pos = this.start; - } + const i = Math.floor(6 * h); + const v = 1 - bl; + f = 6 * h - i; - if (this.fd !== null) { - process.nextTick(function() { - self._read(); - }); - return; - } + if ((i & 0x01) !== 0) { + f = 1 - f; + } - fs.open(this.path, this.flags, this.mode, function (err, fd) { - if (err) { - self.emit('error', err); - self.readable = false; - return; - } + const n = wh + f * (v - wh); // Linear interpolation - self.fd = fd; - self.emit('open', fd); - self._read(); - }) - } + let r; + let g; + let b; + /* eslint-disable max-statements-per-line,no-multi-spaces */ + switch (i) { + default: + case 6: + case 0: r = v; g = n; b = wh; break; + case 1: r = n; g = v; b = wh; break; + case 2: r = wh; g = v; b = n; break; + case 3: r = wh; g = n; b = v; break; + case 4: r = n; g = wh; b = v; break; + case 5: r = v; g = wh; b = n; break; + } + /* eslint-enable max-statements-per-line,no-multi-spaces */ - function WriteStream (path, options) { - if (!(this instanceof WriteStream)) return new WriteStream(path, options); + return [r * 255, g * 255, b * 255]; +}; - Stream.call(this); +convert.cmyk.rgb = function (cmyk) { + const c = cmyk[0] / 100; + const m = cmyk[1] / 100; + const y = cmyk[2] / 100; + const k = cmyk[3] / 100; - this.path = path; - this.fd = null; - this.writable = true; + const r = 1 - Math.min(1, c * (1 - k) + k); + const g = 1 - Math.min(1, m * (1 - k) + k); + const b = 1 - Math.min(1, y * (1 - k) + k); - this.flags = 'w'; - this.encoding = 'binary'; - this.mode = 438; /*=0666*/ - this.bytesWritten = 0; + return [r * 255, g * 255, b * 255]; +}; - options = options || {}; +convert.xyz.rgb = function (xyz) { + const x = xyz[0] / 100; + const y = xyz[1] / 100; + const z = xyz[2] / 100; + let r; + let g; + let b; - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } + r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); + g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); + b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.start < 0) { - throw new Error('start must be >= zero'); - } + // Assume sRGB + r = r > 0.0031308 + ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055) + : r * 12.92; - this.pos = this.start; - } + g = g > 0.0031308 + ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055) + : g * 12.92; - this.busy = false; - this._queue = []; + b = b > 0.0031308 + ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055) + : b * 12.92; - if (this.fd === null) { - this._open = fs.open; - this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); - this.flush(); - } - } -} + r = Math.min(Math.max(0, r), 1); + g = Math.min(Math.max(0, g), 1); + b = Math.min(Math.max(0, b), 1); + return [r * 255, g * 255, b * 255]; +}; -/***/ }), -/* 217 */ -/***/ (function(module, exports, __webpack_require__) { +convert.xyz.lab = function (xyz) { + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; -/** - * @preserve - * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013) - * - * @author Jens Taylor - * @see http://github.com/homebrewing/brauhaus-diff - * @author Gary Court - * @see http://github.com/garycourt/murmurhash-js - * @author Austin Appleby - * @see http://sites.google.com/site/murmurhash/ - */ -(function(){ - var cache; + x /= 95.047; + y /= 100; + z /= 108.883; - // Call this function without `new` to use the cached object (good for - // single-threaded environments), or with `new` to create a new object. - // - // @param {string} key A UTF-16 or ASCII string - // @param {number} seed An optional positive integer - // @return {object} A MurmurHash3 object for incremental hashing - function MurmurHash3(key, seed) { - var m = this instanceof MurmurHash3 ? this : cache; - m.reset(seed) - if (typeof key === 'string' && key.length > 0) { - m.hash(key); - } + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); - if (m !== this) { - return m; - } - }; + const l = (116 * y) - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); - // Incrementally add a string to this hash - // - // @param {string} key A UTF-16 or ASCII string - // @return {object} this - MurmurHash3.prototype.hash = function(key) { - var h1, k1, i, top, len; + return [l, a, b]; +}; - len = key.length; - this.len += len; +convert.lab.xyz = function (lab) { + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let x; + let y; + let z; - k1 = this.k1; - i = 0; - switch (this.rem) { - case 0: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) : 0; - case 1: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 8 : 0; - case 2: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 16 : 0; - case 3: - k1 ^= len > i ? (key.charCodeAt(i) & 0xff) << 24 : 0; - k1 ^= len > i ? (key.charCodeAt(i++) & 0xff00) >> 8 : 0; - } + y = (l + 16) / 116; + x = a / 500 + y; + z = y - b / 200; - this.rem = (len + this.rem) & 3; // & 3 is same as % 4 - len -= this.rem; - if (len > 0) { - h1 = this.h1; - while (1) { - k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff; - k1 = (k1 << 15) | (k1 >>> 17); - k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff; + const y2 = y ** 3; + const x2 = x ** 3; + const z2 = z ** 3; + y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; + x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; + z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; - h1 ^= k1; - h1 = (h1 << 13) | (h1 >>> 19); - h1 = (h1 * 5 + 0xe6546b64) & 0xffffffff; + x *= 95.047; + y *= 100; + z *= 108.883; - if (i >= len) { - break; - } + return [x, y, z]; +}; - k1 = ((key.charCodeAt(i++) & 0xffff)) ^ - ((key.charCodeAt(i++) & 0xffff) << 8) ^ - ((key.charCodeAt(i++) & 0xffff) << 16); - top = key.charCodeAt(i++); - k1 ^= ((top & 0xff) << 24) ^ - ((top & 0xff00) >> 8); - } +convert.lab.lch = function (lab) { + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let h; - k1 = 0; - switch (this.rem) { - case 3: k1 ^= (key.charCodeAt(i + 2) & 0xffff) << 16; - case 2: k1 ^= (key.charCodeAt(i + 1) & 0xffff) << 8; - case 1: k1 ^= (key.charCodeAt(i) & 0xffff); - } + const hr = Math.atan2(b, a); + h = hr * 360 / 2 / Math.PI; - this.h1 = h1; - } + if (h < 0) { + h += 360; + } - this.k1 = k1; - return this; - }; + const c = Math.sqrt(a * a + b * b); - // Get the result of this hash - // - // @return {number} The 32-bit hash - MurmurHash3.prototype.result = function() { - var k1, h1; - - k1 = this.k1; - h1 = this.h1; + return [l, c, h]; +}; - if (k1 > 0) { - k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff; - k1 = (k1 << 15) | (k1 >>> 17); - k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff; - h1 ^= k1; - } +convert.lch.lab = function (lch) { + const l = lch[0]; + const c = lch[1]; + const h = lch[2]; - h1 ^= this.len; + const hr = h / 360 * 2 * Math.PI; + const a = c * Math.cos(hr); + const b = c * Math.sin(hr); - h1 ^= h1 >>> 16; - h1 = (h1 * 0xca6b + (h1 & 0xffff) * 0x85eb0000) & 0xffffffff; - h1 ^= h1 >>> 13; - h1 = (h1 * 0xae35 + (h1 & 0xffff) * 0xc2b20000) & 0xffffffff; - h1 ^= h1 >>> 16; + return [l, a, b]; +}; - return h1 >>> 0; - }; +convert.rgb.ansi16 = function (args, saturation = null) { + const [r, g, b] = args; + let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization - // Reset the hash object for reuse - // - // @param {number} seed An optional positive integer - MurmurHash3.prototype.reset = function(seed) { - this.h1 = typeof seed === 'number' ? seed : 0; - this.rem = this.k1 = this.len = 0; - return this; - }; + value = Math.round(value / 50); - // A cached object to use. This can be safely used if you're in a single- - // threaded environment, otherwise you need to create new hashes to use. - cache = new MurmurHash3(); + if (value === 0) { + return 30; + } - if (true) { - module.exports = MurmurHash3; - } else {} -}()); + let ansi = 30 + + ((Math.round(b / 255) << 2) + | (Math.round(g / 255) << 1) + | Math.round(r / 255)); + if (value === 2) { + ansi += 60; + } -/***/ }), -/* 218 */ -/***/ (function(module, exports, __webpack_require__) { + return ansi; +}; -// Note: since nyc uses this module to output coverage, any lines -// that are in the direct sync flow of nyc's outputCoverage are -// ignored, since we can never get coverage for them. -var assert = __webpack_require__(138) -var signals = __webpack_require__(219) +convert.hsv.ansi16 = function (args) { + // Optimization here; we already know the value and don't need to get + // it converted for us. + return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); +}; -var EE = __webpack_require__(154) -/* istanbul ignore if */ -if (typeof EE !== 'function') { - EE = EE.EventEmitter -} +convert.rgb.ansi256 = function (args) { + const r = args[0]; + const g = args[1]; + const b = args[2]; -var emitter -if (process.__signal_exit_emitter__) { - emitter = process.__signal_exit_emitter__ -} else { - emitter = process.__signal_exit_emitter__ = new EE() - emitter.count = 0 - emitter.emitted = {} -} + // We use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + if (r === g && g === b) { + if (r < 8) { + return 16; + } -// Because this emitter is a global, we have to check to see if a -// previous version of this library failed to enable infinite listeners. -// I know what you're about to say. But literally everything about -// signal-exit is a compromise with evil. Get used to it. -if (!emitter.infinite) { - emitter.setMaxListeners(Infinity) - emitter.infinite = true -} + if (r > 248) { + return 231; + } -module.exports = function (cb, opts) { - assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler') + return Math.round(((r - 8) / 247) * 24) + 232; + } - if (loaded === false) { - load() - } + const ansi = 16 + + (36 * Math.round(r / 255 * 5)) + + (6 * Math.round(g / 255 * 5)) + + Math.round(b / 255 * 5); - var ev = 'exit' - if (opts && opts.alwaysLast) { - ev = 'afterexit' - } + return ansi; +}; - var remove = function () { - emitter.removeListener(ev, cb) - if (emitter.listeners('exit').length === 0 && - emitter.listeners('afterexit').length === 0) { - unload() - } - } - emitter.on(ev, cb) +convert.ansi16.rgb = function (args) { + let color = args % 10; - return remove -} + // Handle greyscale + if (color === 0 || color === 7) { + if (args > 50) { + color += 3.5; + } -module.exports.unload = unload -function unload () { - if (!loaded) { - return - } - loaded = false + color = color / 10.5 * 255; - signals.forEach(function (sig) { - try { - process.removeListener(sig, sigListeners[sig]) - } catch (er) {} - }) - process.emit = originalProcessEmit - process.reallyExit = originalProcessReallyExit - emitter.count -= 1 -} + return [color, color, color]; + } -function emit (event, code, signal) { - if (emitter.emitted[event]) { - return - } - emitter.emitted[event] = true - emitter.emit(event, code, signal) -} + const mult = (~~(args > 50) + 1) * 0.5; + const r = ((color & 1) * mult) * 255; + const g = (((color >> 1) & 1) * mult) * 255; + const b = (((color >> 2) & 1) * mult) * 255; -// { : , ... } -var sigListeners = {} -signals.forEach(function (sig) { - sigListeners[sig] = function listener () { - // If there are no other listeners, an exit is coming! - // Simplest way: remove us and then re-send the signal. - // We know that this will kill the process, so we can - // safely emit now. - var listeners = process.listeners(sig) - if (listeners.length === emitter.count) { - unload() - emit('exit', null, sig) - /* istanbul ignore next */ - emit('afterexit', null, sig) - /* istanbul ignore next */ - process.kill(process.pid, sig) - } - } -}) + return [r, g, b]; +}; -module.exports.signals = function () { - return signals -} +convert.ansi256.rgb = function (args) { + // Handle greyscale + if (args >= 232) { + const c = (args - 232) * 10 + 8; + return [c, c, c]; + } -module.exports.load = load + args -= 16; -var loaded = false + let rem; + const r = Math.floor(args / 36) / 5 * 255; + const g = Math.floor((rem = args % 36) / 6) / 5 * 255; + const b = (rem % 6) / 5 * 255; -function load () { - if (loaded) { - return - } - loaded = true + return [r, g, b]; +}; - // This is the number of onSignalExit's that are in play. - // It's important so that we can count the correct number of - // listeners on signals, and don't wait for the other one to - // handle it instead of us. - emitter.count += 1 +convert.rgb.hex = function (args) { + const integer = ((Math.round(args[0]) & 0xFF) << 16) + + ((Math.round(args[1]) & 0xFF) << 8) + + (Math.round(args[2]) & 0xFF); - signals = signals.filter(function (sig) { - try { - process.on(sig, sigListeners[sig]) - return true - } catch (er) { - return false - } - }) + const string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; - process.emit = processEmit - process.reallyExit = processReallyExit -} +convert.hex.rgb = function (args) { + const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); + if (!match) { + return [0, 0, 0]; + } -var originalProcessReallyExit = process.reallyExit -function processReallyExit (code) { - process.exitCode = code || 0 - emit('exit', process.exitCode, null) - /* istanbul ignore next */ - emit('afterexit', process.exitCode, null) - /* istanbul ignore next */ - originalProcessReallyExit.call(process, process.exitCode) -} + let colorString = match[0]; -var originalProcessEmit = process.emit -function processEmit (ev, arg) { - if (ev === 'exit') { - if (arg !== undefined) { - process.exitCode = arg - } - var ret = originalProcessEmit.apply(this, arguments) - emit('exit', process.exitCode, null) - /* istanbul ignore next */ - emit('afterexit', process.exitCode, null) - return ret - } else { - return originalProcessEmit.apply(this, arguments) - } -} + if (match[0].length === 3) { + colorString = colorString.split('').map(char => { + return char + char; + }).join(''); + } + const integer = parseInt(colorString, 16); + const r = (integer >> 16) & 0xFF; + const g = (integer >> 8) & 0xFF; + const b = integer & 0xFF; -/***/ }), -/* 219 */ -/***/ (function(module, exports) { + return [r, g, b]; +}; -// This is not the set of all possible signals. -// -// It IS, however, the set of all signals that trigger -// an exit on either Linux or BSD systems. Linux is a -// superset of the signal names supported on BSD, and -// the unknown signals just fail to register, so we can -// catch that easily enough. -// -// Don't bother with SIGKILL. It's uncatchable, which -// means that we can't fire any callbacks anyway. -// -// If a user does happen to register a handler on a non- -// fatal signal like SIGWINCH or something, and then -// exit, it'll end up firing `process.emit('exit')`, so -// the handler will be fired anyway. -// -// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised -// artificially, inherently leave the process in a -// state from which it is not safe to try and enter JS -// listeners. -module.exports = [ - 'SIGABRT', - 'SIGALRM', - 'SIGHUP', - 'SIGINT', - 'SIGTERM' -] +convert.rgb.hcg = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const max = Math.max(Math.max(r, g), b); + const min = Math.min(Math.min(r, g), b); + const chroma = (max - min); + let grayscale; + let hue; -if (process.platform !== 'win32') { - module.exports.push( - 'SIGVTALRM', - 'SIGXCPU', - 'SIGXFSZ', - 'SIGUSR2', - 'SIGTRAP', - 'SIGSYS', - 'SIGQUIT', - 'SIGIOT' - // should detect profiler and enable/disable accordingly. - // see #21 - // 'SIGPROF' - ) -} + if (chroma < 1) { + grayscale = min / (1 - chroma); + } else { + grayscale = 0; + } -if (process.platform === 'linux') { - module.exports.push( - 'SIGIO', - 'SIGPOLL', - 'SIGPWR', - 'SIGSTKFLT', - 'SIGUNUSED' - ) -} + if (chroma <= 0) { + hue = 0; + } else + if (max === r) { + hue = ((g - b) / chroma) % 6; + } else + if (max === g) { + hue = 2 + (b - r) / chroma; + } else { + hue = 4 + (r - g) / chroma; + } + hue /= 6; + hue %= 1; -/***/ }), -/* 220 */ -/***/ (function(module, exports) { + return [hue * 360, chroma * 100, grayscale * 100]; +}; -module.exports = require(undefined); +convert.hsl.hcg = function (hsl) { + const s = hsl[1] / 100; + const l = hsl[2] / 100; -/***/ }), -/* 221 */ -/***/ (function(module, exports, __webpack_require__) { + const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l)); -"use strict"; + let f = 0; + if (c < 1.0) { + f = (l - 0.5 * c) / (1.0 - c); + } -const isPlainObj = __webpack_require__(222); + return [hsl[0], c * 100, f * 100]; +}; -module.exports = (obj, opts) => { - if (!isPlainObj(obj)) { - throw new TypeError('Expected a plain object'); +convert.hsv.hcg = function (hsv) { + const s = hsv[1] / 100; + const v = hsv[2] / 100; + + const c = s * v; + let f = 0; + + if (c < 1.0) { + f = (v - c) / (1 - c); } - opts = opts || {}; + return [hsv[0], c * 100, f * 100]; +}; - // DEPRECATED - if (typeof opts === 'function') { - throw new TypeError('Specify the compare function as an option instead'); +convert.hcg.rgb = function (hcg) { + const h = hcg[0] / 360; + const c = hcg[1] / 100; + const g = hcg[2] / 100; + + if (c === 0.0) { + return [g * 255, g * 255, g * 255]; } - const deep = opts.deep; - const seenInput = []; - const seenOutput = []; + const pure = [0, 0, 0]; + const hi = (h % 1) * 6; + const v = hi % 1; + const w = 1 - v; + let mg = 0; - const sortKeys = x => { - const seenIndex = seenInput.indexOf(x); + /* eslint-disable max-statements-per-line */ + switch (Math.floor(hi)) { + case 0: + pure[0] = 1; pure[1] = v; pure[2] = 0; break; + case 1: + pure[0] = w; pure[1] = 1; pure[2] = 0; break; + case 2: + pure[0] = 0; pure[1] = 1; pure[2] = v; break; + case 3: + pure[0] = 0; pure[1] = w; pure[2] = 1; break; + case 4: + pure[0] = v; pure[1] = 0; pure[2] = 1; break; + default: + pure[0] = 1; pure[1] = 0; pure[2] = w; + } + /* eslint-enable max-statements-per-line */ - if (seenIndex !== -1) { - return seenOutput[seenIndex]; - } + mg = (1.0 - c) * g; - const ret = {}; - const keys = Object.keys(x).sort(opts.compare); + return [ + (c * pure[0] + mg) * 255, + (c * pure[1] + mg) * 255, + (c * pure[2] + mg) * 255 + ]; +}; - seenInput.push(x); - seenOutput.push(ret); +convert.hcg.hsv = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - const val = x[key]; + const v = c + g * (1.0 - c); + let f = 0; - if (deep && Array.isArray(val)) { - const retArr = []; + if (v > 0.0) { + f = c / v; + } - for (let j = 0; j < val.length; j++) { - retArr[j] = isPlainObj(val[j]) ? sortKeys(val[j]) : val[j]; - } + return [hcg[0], f * 100, v * 100]; +}; - ret[key] = retArr; - continue; - } +convert.hcg.hsl = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; - ret[key] = deep && isPlainObj(val) ? sortKeys(val) : val; - } + const l = g * (1.0 - c) + 0.5 * c; + let s = 0; - return ret; - }; + if (l > 0.0 && l < 0.5) { + s = c / (2 * l); + } else + if (l >= 0.5 && l < 1.0) { + s = c / (2 * (1 - l)); + } - return sortKeys(obj); + return [hcg[0], s * 100, l * 100]; }; +convert.hcg.hwb = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + const v = c + g * (1.0 - c); + return [hcg[0], (v - c) * 100, (1 - v) * 100]; +}; -/***/ }), -/* 222 */ -/***/ (function(module, exports, __webpack_require__) { +convert.hwb.hcg = function (hwb) { + const w = hwb[1] / 100; + const b = hwb[2] / 100; + const v = 1 - b; + const c = v - w; + let g = 0; -"use strict"; + if (c < 1) { + g = (v - c) / (1 - c); + } -var toString = Object.prototype.toString; + return [hwb[0], c * 100, g * 100]; +}; -module.exports = function (x) { - var prototype; - return toString.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); +convert.apple.rgb = function (apple) { + return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; }; +convert.rgb.apple = function (rgb) { + return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; +}; -/***/ }), -/* 223 */ -/***/ (function(module, exports, __webpack_require__) { +convert.gray.rgb = function (args) { + return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; +}; -"use strict"; +convert.gray.hsl = function (args) { + return [0, 0, args[0]]; +}; -const fs = __webpack_require__(132); -const path = __webpack_require__(4); -const pify = __webpack_require__(224); -const semver = __webpack_require__(182); +convert.gray.hsv = convert.gray.hsl; -const defaults = { - mode: 0o777 & (~process.umask()), - fs +convert.gray.hwb = function (gray) { + return [0, 100, gray[0]]; }; -const useNativeRecursiveOption = semver.satisfies(process.version, '>=10.12.0'); - -// https://github.com/nodejs/node/issues/8987 -// https://github.com/libuv/libuv/pull/1088 -const checkPath = pth => { - if (process.platform === 'win32') { - const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, '')); +convert.gray.cmyk = function (gray) { + return [0, 0, 0, gray[0]]; +}; - if (pathHasInvalidWinCharacters) { - const error = new Error(`Path contains invalid characters: ${pth}`); - error.code = 'EINVAL'; - throw error; - } - } +convert.gray.lab = function (gray) { + return [gray[0], 0, 0]; }; -const permissionError = pth => { - // This replicates the exception of `fs.mkdir` with native the - // `recusive` option when run on an invalid drive under Windows. - const error = new Error(`operation not permitted, mkdir '${pth}'`); - error.code = 'EPERM'; - error.errno = -4048; - error.path = pth; - error.syscall = 'mkdir'; - return error; +convert.gray.hex = function (gray) { + const val = Math.round(gray[0] / 100 * 255) & 0xFF; + const integer = (val << 16) + (val << 8) + val; + + const string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; }; -const makeDir = (input, options) => Promise.resolve().then(() => { - checkPath(input); - options = Object.assign({}, defaults, options); +convert.rgb.gray = function (rgb) { + const val = (rgb[0] + rgb[1] + rgb[2]) / 3; + return [val / 255 * 100]; +}; - // TODO: Use util.promisify when targeting Node.js 8 - const mkdir = pify(options.fs.mkdir); - const stat = pify(options.fs.stat); - if (useNativeRecursiveOption && options.fs.mkdir === fs.mkdir) { - const pth = path.resolve(input); +/***/ }), +/* 239 */ +/***/ (function(module, exports, __webpack_require__) { - return mkdir(pth, { - mode: options.mode, - recursive: true - }).then(() => pth); - } +const conversions = __webpack_require__(238); - const make = pth => { - return mkdir(pth, options.mode) - .then(() => pth) - .catch(error => { - if (error.code === 'EPERM') { - throw error; - } +/* + This function routes a model to all other models. - if (error.code === 'ENOENT') { - if (path.dirname(pth) === pth) { - throw permissionError(pth); - } + all functions that are routed have a property `.conversion` attached + to the returned synthetic function. This property is an array + of strings, each with the steps in between the 'from' and 'to' + color models (inclusive). - if (error.message.includes('null bytes')) { - throw error; - } + conversions that are not possible simply are not included. +*/ - return make(path.dirname(pth)).then(() => make(pth)); - } +function buildGraph() { + const graph = {}; + // https://jsperf.com/object-keys-vs-for-in-with-closure/3 + const models = Object.keys(conversions); - return stat(pth) - .then(stats => stats.isDirectory() ? pth : Promise.reject()) - .catch(() => { - throw error; - }); - }); - }; + for (let len = models.length, i = 0; i < len; i++) { + graph[models[i]] = { + // http://jsperf.com/1-vs-infinity + // micro-opt, but this is simple. + distance: -1, + parent: null + }; + } - return make(path.resolve(input)); -}); + return graph; +} -module.exports = makeDir; -module.exports.default = makeDir; +// https://en.wikipedia.org/wiki/Breadth-first_search +function deriveBFS(fromModel) { + const graph = buildGraph(); + const queue = [fromModel]; // Unshift -> queue -> pop -module.exports.sync = (input, options) => { - checkPath(input); - options = Object.assign({}, defaults, options); + graph[fromModel].distance = 0; - if (useNativeRecursiveOption && options.fs.mkdirSync === fs.mkdirSync) { - const pth = path.resolve(input); + while (queue.length) { + const current = queue.pop(); + const adjacents = Object.keys(conversions[current]); - fs.mkdirSync(pth, { - mode: options.mode, - recursive: true - }); + for (let len = adjacents.length, i = 0; i < len; i++) { + const adjacent = adjacents[i]; + const node = graph[adjacent]; - return pth; + if (node.distance === -1) { + node.distance = graph[current].distance + 1; + node.parent = current; + queue.unshift(adjacent); + } + } } - const make = pth => { - try { - options.fs.mkdirSync(pth, options.mode); - } catch (error) { - if (error.code === 'EPERM') { - throw error; - } + return graph; +} - if (error.code === 'ENOENT') { - if (path.dirname(pth) === pth) { - throw permissionError(pth); - } +function link(from, to) { + return function (args) { + return to(from(args)); + }; +} - if (error.message.includes('null bytes')) { - throw error; - } +function wrapConversion(toModel, graph) { + const path = [graph[toModel].parent, toModel]; + let fn = conversions[graph[toModel].parent][toModel]; - make(path.dirname(pth)); - return make(pth); - } + let cur = graph[toModel].parent; + while (graph[cur].parent) { + path.unshift(graph[cur].parent); + fn = link(conversions[graph[cur].parent][cur], fn); + cur = graph[cur].parent; + } - try { - if (!options.fs.statSync(pth).isDirectory()) { - throw new Error('The path is not a directory'); - } - } catch (_) { - throw error; - } + fn.conversion = path; + return fn; +} + +module.exports = function (fromModel) { + const graph = deriveBFS(fromModel); + const conversion = {}; + + const models = Object.keys(graph); + for (let len = models.length, i = 0; i < len; i++) { + const toModel = models[i]; + const node = graph[toModel]; + + if (node.parent === null) { + // No possible conversion, or this node is the source model. + continue; } - return pth; - }; + conversion[toModel] = wrapConversion(toModel, graph); + } - return make(path.resolve(input)); + return conversion; }; + /***/ }), -/* 224 */ +/* 240 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +const os = __webpack_require__(120); +const tty = __webpack_require__(121); +const hasFlag = __webpack_require__(241); -const processFn = (fn, options) => function (...args) { - const P = options.promiseModule; - - return new P((resolve, reject) => { - if (options.multiArgs) { - args.push((...result) => { - if (options.errorFirst) { - if (result[0]) { - reject(result); - } else { - result.shift(); - resolve(result); - } - } else { - resolve(result); - } - }); - } else if (options.errorFirst) { - args.push((error, result) => { - if (error) { - reject(error); - } else { - resolve(result); - } - }); - } else { - args.push(resolve); - } +const {env} = process; - fn.apply(this, args); - }); -}; +let forceColor; +if (hasFlag('no-color') || + hasFlag('no-colors') || + hasFlag('color=false') || + hasFlag('color=never')) { + forceColor = 0; +} else if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { + forceColor = 1; +} -module.exports = (input, options) => { - options = Object.assign({ - exclude: [/.+(Sync|Stream)$/], - errorFirst: true, - promiseModule: Promise - }, options); +if ('FORCE_COLOR' in env) { + if (env.FORCE_COLOR === 'true') { + forceColor = 1; + } else if (env.FORCE_COLOR === 'false') { + forceColor = 0; + } else { + forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3); + } +} - const objType = typeof input; - if (!(input !== null && (objType === 'object' || objType === 'function'))) { - throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${input === null ? 'null' : objType}\``); +function translateLevel(level) { + if (level === 0) { + return false; } - const filter = key => { - const match = pattern => typeof pattern === 'string' ? key === pattern : pattern.test(key); - return options.include ? options.include.some(match) : !options.exclude.some(match); + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 }; +} - let ret; - if (objType === 'function') { - ret = function (...args) { - return options.excludeMain ? input(...args) : processFn(input, options).apply(this, args); - }; - } else { - ret = Object.create(Object.getPrototypeOf(input)); +function supportsColor(haveStream, streamIsTTY) { + if (forceColor === 0) { + return 0; } - for (const key in input) { // eslint-disable-line guard-for-in - const property = input[key]; - ret[key] = typeof property === 'function' && filter(key) ? processFn(property, options) : property; + if (hasFlag('color=16m') || + hasFlag('color=full') || + hasFlag('color=truecolor')) { + return 3; } - return ret; -}; + if (hasFlag('color=256')) { + return 2; + } + if (haveStream && !streamIsTTY && forceColor === undefined) { + return 0; + } -/***/ }), -/* 225 */ -/***/ (function(module, exports, __webpack_require__) { + const min = forceColor || 0; -"use strict"; + if (env.TERM === 'dumb') { + return min; + } + if (process.platform === 'win32') { + // Windows 10 build 10586 is the first Windows release that supports 256 colors. + // Windows 10 build 14931 is the first release that supports 16m/TrueColor. + const osRelease = os.release().split('.'); + if ( + Number(osRelease[0]) >= 10 && + Number(osRelease[2]) >= 10586 + ) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } -// detect either spaces or tabs but not both to properly handle tabs -// for indentation and spaces for alignment -const INDENT_RE = /^(?:( )+|\t+)/; + return 1; + } -function getMostUsed(indents) { - let result = 0; - let maxUsed = 0; - let maxWeight = 0; + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + return 1; + } - for (const entry of indents) { - // TODO: use destructuring when targeting Node.js 6 - const key = entry[0]; - const val = entry[1]; + return min; + } - const u = val[0]; - const w = val[1]; + if ('TEAMCITY_VERSION' in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; + } - if (u > maxUsed || (u === maxUsed && w > maxWeight)) { - maxUsed = u; - maxWeight = w; - result = Number(key); + if ('GITHUB_ACTIONS' in env) { + return 1; + } + + if (env.COLORTERM === 'truecolor') { + return 3; + } + + if ('TERM_PROGRAM' in env) { + const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Apple_Terminal': + return 2; + // No default } } - return result; -} + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } -module.exports = str => { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; } - // used to see if tabs or spaces are the most used - let tabs = 0; - let spaces = 0; + if ('COLORTERM' in env) { + return 1; + } - // remember the size of previous line's indentation - let prev = 0; + return min; +} - // remember how many indents/unindents as occurred for a given size - // and how much lines follow a given indentation - // - // indents = { - // 3: [1, 0], - // 4: [1, 5], - // 5: [1, 0], - // 12: [1, 0], - // } - const indents = new Map(); +function getSupportLevel(stream) { + const level = supportsColor(stream, stream && stream.isTTY); + return translateLevel(level); +} - // pointer to the array of last used indent - let current; +module.exports = { + supportsColor: getSupportLevel, + stdout: translateLevel(supportsColor(true, tty.isatty(1))), + stderr: translateLevel(supportsColor(true, tty.isatty(2))) +}; + + +/***/ }), +/* 241 */ +/***/ (function(module, exports, __webpack_require__) { - // whether the last action was an indent (opposed to an unindent) - let isIndent; +"use strict"; - for (const line of str.split(/\n/g)) { - if (!line) { - // ignore empty lines - continue; - } - let indent; - const matches = line.match(INDENT_RE); +module.exports = (flag, argv = process.argv) => { + const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); + const position = argv.indexOf(prefix + flag); + const terminatorPosition = argv.indexOf('--'); + return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); +}; - if (matches) { - indent = matches[0].length; - if (matches[1]) { - spaces++; - } else { - tabs++; - } - } else { - indent = 0; - } +/***/ }), +/* 242 */ +/***/ (function(module, exports, __webpack_require__) { - const diff = indent - prev; - prev = indent; +"use strict"; - if (diff) { - // an indent or unindent has been detected - isIndent = diff > 0; +const stringReplaceAll = (string, substring, replacer) => { + let index = string.indexOf(substring); + if (index === -1) { + return string; + } - current = indents.get(isIndent ? diff : -diff); + const substringLength = substring.length; + let endIndex = 0; + let returnValue = ''; + do { + returnValue += string.substr(endIndex, index - endIndex) + substring + replacer; + endIndex = index + substringLength; + index = string.indexOf(substring, endIndex); + } while (index !== -1); - if (current) { - current[0]++; - } else { - current = [1, 0]; - indents.set(diff, current); - } - } else if (current) { - // if the last action was an indent, increment the weight - current[1] += Number(isIndent); - } - } + returnValue += string.substr(endIndex); + return returnValue; +}; - const amount = getMostUsed(indents); +const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => { + let endIndex = 0; + let returnValue = ''; + do { + const gotCR = string[index - 1] === '\r'; + returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix; + endIndex = index + 1; + index = string.indexOf('\n', endIndex); + } while (index !== -1); - let type; - let indent; - if (!amount) { - type = null; - indent = ''; - } else if (spaces >= tabs) { - type = 'space'; - indent = ' '.repeat(amount); - } else { - type = 'tab'; - indent = '\t'.repeat(amount); - } + returnValue += string.substr(endIndex); + return returnValue; +}; - return { - amount, - type, - indent - }; +module.exports = { + stringReplaceAll, + stringEncaseCRLFWithFirstIndex }; /***/ }), -/* 226 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/* 243 */ +/***/ (function(module, exports, __webpack_require__) { "use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "installInDir", function() { return installInDir; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runScriptInPackage", function() { return runScriptInPackage; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runScriptInPackageStreaming", function() { return runScriptInPackageStreaming; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "yarnWorkspacesInfo", function() { return yarnWorkspacesInfo; }); -/* harmony import */ var _child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(227); -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -const YARN_EXEC = process.env.npm_execpath || 'yarn'; +const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; +const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; +const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; +const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi; -/** - * Install all dependencies in the given directory - */ -async function installInDir(directory, extraArgs = []) { - const options = ['install', '--non-interactive', ...extraArgs]; // We pass the mutex flag to ensure only one instance of yarn runs at any - // given time (e.g. to avoid conflicts). +const ESCAPES = new Map([ + ['n', '\n'], + ['r', '\r'], + ['t', '\t'], + ['b', '\b'], + ['f', '\f'], + ['v', '\v'], + ['0', '\0'], + ['\\', '\\'], + ['e', '\u001B'], + ['a', '\u0007'] +]); - await Object(_child_process__WEBPACK_IMPORTED_MODULE_0__["spawn"])(YARN_EXEC, options, { - cwd: directory - }); -} -/** - * Run script in the given directory - */ +function unescape(c) { + const u = c[0] === 'u'; + const bracket = c[1] === '{'; -async function runScriptInPackage(script, args, pkg) { - const execOpts = { - cwd: pkg.path - }; - await Object(_child_process__WEBPACK_IMPORTED_MODULE_0__["spawn"])(YARN_EXEC, ['run', script, ...args], execOpts); -} -/** - * Run script in the given directory - */ + if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) { + return String.fromCharCode(parseInt(c.slice(1), 16)); + } -function runScriptInPackageStreaming({ - script, - args, - pkg, - debug -}) { - const execOpts = { - cwd: pkg.path - }; - return Object(_child_process__WEBPACK_IMPORTED_MODULE_0__["spawnStreaming"])(YARN_EXEC, ['run', script, ...args], execOpts, { - prefix: pkg.name, - debug - }); -} -async function yarnWorkspacesInfo(directory) { - const { - stdout - } = await Object(_child_process__WEBPACK_IMPORTED_MODULE_0__["spawn"])(YARN_EXEC, ['--json', 'workspaces', 'info'], { - cwd: directory, - stdio: 'pipe' - }); + if (u && bracket) { + return String.fromCodePoint(parseInt(c.slice(2, -1), 16)); + } - try { - return JSON.parse(JSON.parse(stdout).data); - } catch (error) { - throw new Error(`'yarn workspaces info --json' produced unexpected output: \n${stdout}`); - } + return ESCAPES.get(c) || c; } -/***/ }), -/* 227 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +function parseArguments(name, arguments_) { + const results = []; + const chunks = arguments_.trim().split(/\s*,\s*/g); + let matches; -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "spawn", function() { return spawn; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "spawnStreaming", function() { return spawnStreaming; }); -/* harmony import */ var stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(136); -/* harmony import */ var stream__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(stream__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(112); -/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var execa__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(228); -/* harmony import */ var execa__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(execa__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var strong_log_transformer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(263); -/* harmony import */ var strong_log_transformer__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(strong_log_transformer__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(142); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + for (const chunk of chunks) { + const number = Number(chunk); + if (!Number.isNaN(number)) { + results.push(number); + } else if ((matches = chunk.match(STRING_REGEX))) { + results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character)); + } else { + throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); + } + } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + return results; +} -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function parseStyle(style) { + STYLE_REGEX.lastIndex = 0; -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ + const results = []; + let matches; + while ((matches = STYLE_REGEX.exec(style)) !== null) { + const name = matches[1]; + if (matches[2]) { + const args = parseArguments(name, matches[2]); + results.push([name].concat(args)); + } else { + results.push([name]); + } + } + return results; +} +function buildStyle(chalk, styles) { + const enabled = {}; -const colorWheel = [chalk__WEBPACK_IMPORTED_MODULE_1___default.a.cyan, chalk__WEBPACK_IMPORTED_MODULE_1___default.a.magenta, chalk__WEBPACK_IMPORTED_MODULE_1___default.a.blue, chalk__WEBPACK_IMPORTED_MODULE_1___default.a.yellow, chalk__WEBPACK_IMPORTED_MODULE_1___default.a.green]; + for (const layer of styles) { + for (const style of layer.styles) { + enabled[style[0]] = layer.inverse ? null : style.slice(1); + } + } -const getColor = () => { - const color = colorWheel.shift(); - colorWheel.push(color); - return color; -}; + let current = chalk; + for (const [styleName, styles] of Object.entries(enabled)) { + if (!Array.isArray(styles)) { + continue; + } -function spawn(command, args, opts) { - return execa__WEBPACK_IMPORTED_MODULE_2___default()(command, args, _objectSpread({ - stdio: 'inherit', - preferLocal: true - }, opts)); + if (!(styleName in current)) { + throw new Error(`Unknown Chalk style: ${styleName}`); + } + + current = styles.length > 0 ? current[styleName](...styles) : current[styleName]; + } + + return current; } -function streamToLog(debug = true) { - return new stream__WEBPACK_IMPORTED_MODULE_0__["Writable"]({ - objectMode: true, +module.exports = (chalk, temporary) => { + const styles = []; + const chunks = []; + let chunk = []; - write(line, _, cb) { - if (line.endsWith('\n')) { - _log__WEBPACK_IMPORTED_MODULE_4__["log"][debug ? 'debug' : 'write'](line.slice(0, -1)); - } else { - _log__WEBPACK_IMPORTED_MODULE_4__["log"][debug ? 'debug' : 'write'](line); - } + // eslint-disable-next-line max-params + temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => { + if (escapeCharacter) { + chunk.push(unescape(escapeCharacter)); + } else if (style) { + const string = chunk.join(''); + chunk = []; + chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string)); + styles.push({inverse, styles: parseStyle(style)}); + } else if (close) { + if (styles.length === 0) { + throw new Error('Found extraneous } in Chalk template literal'); + } - cb(); - } + chunks.push(buildStyle(chalk, styles)(chunk.join(''))); + chunk = []; + styles.pop(); + } else { + chunk.push(character); + } + }); - }); -} + chunks.push(chunk.join('')); + + if (styles.length > 0) { + const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; + throw new Error(errMessage); + } + + return chunks.join(''); +}; -function spawnStreaming(command, args, opts, { - prefix, - debug -}) { - const spawned = execa__WEBPACK_IMPORTED_MODULE_2___default()(command, args, _objectSpread({ - stdio: ['ignore', 'pipe', 'pipe'], - preferLocal: true - }, opts)); - const color = getColor(); - const prefixedStdout = strong_log_transformer__WEBPACK_IMPORTED_MODULE_3___default()({ - tag: color.bold(prefix) - }); - const prefixedStderr = strong_log_transformer__WEBPACK_IMPORTED_MODULE_3___default()({ - mergeMultiline: true, - tag: color.bold(prefix) - }); - spawned.stdout.pipe(prefixedStdout).pipe(streamToLog(debug)); - spawned.stderr.pipe(prefixedStderr).pipe(streamToLog(debug)); - return spawned; -} /***/ }), -/* 228 */ +/* 244 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(4); -const childProcess = __webpack_require__(229); -const crossSpawn = __webpack_require__(230); -const stripFinalNewline = __webpack_require__(243); -const npmRunPath = __webpack_require__(244); -const onetime = __webpack_require__(245); -const makeError = __webpack_require__(247); -const normalizeStdio = __webpack_require__(252); -const {spawnedKill, spawnedCancel, setupTimeout, setExitHandler} = __webpack_require__(253); -const {handleInput, getSpawnedResult, makeAllStream, validateInputSync} = __webpack_require__(254); -const {mergePromise, getSpawnedPromise} = __webpack_require__(261); -const {joinCommand, parseCommand} = __webpack_require__(262); +const childProcess = __webpack_require__(245); +const crossSpawn = __webpack_require__(246); +const stripFinalNewline = __webpack_require__(259); +const npmRunPath = __webpack_require__(260); +const onetime = __webpack_require__(261); +const makeError = __webpack_require__(263); +const normalizeStdio = __webpack_require__(268); +const {spawnedKill, spawnedCancel, setupTimeout, setExitHandler} = __webpack_require__(269); +const {handleInput, getSpawnedResult, makeAllStream, validateInputSync} = __webpack_require__(270); +const {mergePromise, getSpawnedPromise} = __webpack_require__(277); +const {joinCommand, parseCommand} = __webpack_require__(278); const DEFAULT_MAX_BUFFER = 1000 * 1000 * 100; @@ -24239,21 +27302,21 @@ module.exports.node = (scriptPath, args, options = {}) => { /***/ }), -/* 229 */ +/* 245 */ /***/ (function(module, exports) { module.exports = require("child_process"); /***/ }), -/* 230 */ +/* 246 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const cp = __webpack_require__(229); -const parse = __webpack_require__(231); -const enoent = __webpack_require__(242); +const cp = __webpack_require__(245); +const parse = __webpack_require__(247); +const enoent = __webpack_require__(258); function spawn(command, args, options) { // Parse the arguments @@ -24291,16 +27354,16 @@ module.exports._enoent = enoent; /***/ }), -/* 231 */ +/* 247 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(4); -const resolveCommand = __webpack_require__(232); -const escape = __webpack_require__(238); -const readShebang = __webpack_require__(239); +const resolveCommand = __webpack_require__(248); +const escape = __webpack_require__(254); +const readShebang = __webpack_require__(255); const isWin = process.platform === 'win32'; const isExecutableRegExp = /\.(?:com|exe)$/i; @@ -24389,15 +27452,15 @@ module.exports = parse; /***/ }), -/* 232 */ +/* 248 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(4); -const which = __webpack_require__(233); -const pathKey = __webpack_require__(237)(); +const which = __webpack_require__(249); +const pathKey = __webpack_require__(253)(); function resolveCommandAttempt(parsed, withoutPathExt) { const cwd = process.cwd(); @@ -24447,7 +27510,7 @@ module.exports = resolveCommand; /***/ }), -/* 233 */ +/* 249 */ /***/ (function(module, exports, __webpack_require__) { const isWindows = process.platform === 'win32' || @@ -24456,7 +27519,7 @@ const isWindows = process.platform === 'win32' || const path = __webpack_require__(4) const COLON = isWindows ? ';' : ':' -const isexe = __webpack_require__(234) +const isexe = __webpack_require__(250) const getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' }) @@ -24578,15 +27641,15 @@ which.sync = whichSync /***/ }), -/* 234 */ +/* 250 */ /***/ (function(module, exports, __webpack_require__) { -var fs = __webpack_require__(132) +var fs = __webpack_require__(133) var core if (process.platform === 'win32' || global.TESTING_WINDOWS) { - core = __webpack_require__(235) + core = __webpack_require__(251) } else { - core = __webpack_require__(236) + core = __webpack_require__(252) } module.exports = isexe @@ -24641,13 +27704,13 @@ function sync (path, options) { /***/ }), -/* 235 */ +/* 251 */ /***/ (function(module, exports, __webpack_require__) { module.exports = isexe isexe.sync = sync -var fs = __webpack_require__(132) +var fs = __webpack_require__(133) function checkPathExt (path, options) { var pathext = options.pathExt !== undefined ? @@ -24689,13 +27752,13 @@ function sync (path, options) { /***/ }), -/* 236 */ +/* 252 */ /***/ (function(module, exports, __webpack_require__) { module.exports = isexe isexe.sync = sync -var fs = __webpack_require__(132) +var fs = __webpack_require__(133) function isexe (path, options, cb) { fs.stat(path, function (er, stat) { @@ -24736,7 +27799,7 @@ function checkMode (stat, options) { /***/ }), -/* 237 */ +/* 253 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -24759,7 +27822,7 @@ module.exports.default = pathKey; /***/ }), -/* 238 */ +/* 254 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -24811,14 +27874,14 @@ module.exports.argument = escapeArgument; /***/ }), -/* 239 */ +/* 255 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const fs = __webpack_require__(132); -const shebangCommand = __webpack_require__(240); +const fs = __webpack_require__(133); +const shebangCommand = __webpack_require__(256); function readShebang(command) { // Read the first 150 bytes from the file @@ -24841,12 +27904,12 @@ module.exports = readShebang; /***/ }), -/* 240 */ +/* 256 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const shebangRegex = __webpack_require__(241); +const shebangRegex = __webpack_require__(257); module.exports = (string = '') => { const match = string.match(shebangRegex); @@ -24867,7 +27930,7 @@ module.exports = (string = '') => { /***/ }), -/* 241 */ +/* 257 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -24876,7 +27939,7 @@ module.exports = /^#!(.*)/; /***/ }), -/* 242 */ +/* 258 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -24942,7 +28005,7 @@ module.exports = { /***/ }), -/* 243 */ +/* 259 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -24965,13 +28028,13 @@ module.exports = input => { /***/ }), -/* 244 */ +/* 260 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(4); -const pathKey = __webpack_require__(237); +const pathKey = __webpack_require__(253); const npmRunPath = options => { options = { @@ -25019,12 +28082,12 @@ module.exports.env = options => { /***/ }), -/* 245 */ +/* 261 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const mimicFn = __webpack_require__(246); +const mimicFn = __webpack_require__(262); const calledFunctions = new WeakMap(); @@ -25076,7 +28139,7 @@ module.exports.callCount = fn => { /***/ }), -/* 246 */ +/* 262 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -25096,12 +28159,12 @@ module.exports.default = mimicFn; /***/ }), -/* 247 */ +/* 263 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const {signalsByName} = __webpack_require__(248); +const {signalsByName} = __webpack_require__(264); const getErrorPrefix = ({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled}) => { if (timedOut) { @@ -25189,14 +28252,14 @@ module.exports = makeError; /***/ }), -/* 248 */ +/* 264 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -Object.defineProperty(exports,"__esModule",{value:true});exports.signalsByNumber=exports.signalsByName=void 0;var _os=__webpack_require__(121); +Object.defineProperty(exports,"__esModule",{value:true});exports.signalsByNumber=exports.signalsByName=void 0;var _os=__webpack_require__(120); -var _signals=__webpack_require__(249); -var _realtime=__webpack_require__(251); +var _signals=__webpack_require__(265); +var _realtime=__webpack_require__(267); @@ -25266,14 +28329,14 @@ const signalsByNumber=getSignalsByNumber();exports.signalsByNumber=signalsByNumb //# sourceMappingURL=main.js.map /***/ }), -/* 249 */ +/* 265 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -Object.defineProperty(exports,"__esModule",{value:true});exports.getSignals=void 0;var _os=__webpack_require__(121); +Object.defineProperty(exports,"__esModule",{value:true});exports.getSignals=void 0;var _os=__webpack_require__(120); -var _core=__webpack_require__(250); -var _realtime=__webpack_require__(251); +var _core=__webpack_require__(266); +var _realtime=__webpack_require__(267); @@ -25307,7 +28370,7 @@ return{name,number,description,supported,action,forced,standard}; //# sourceMappingURL=signals.js.map /***/ }), -/* 250 */ +/* 266 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -25586,7 +28649,7 @@ standard:"other"}];exports.SIGNALS=SIGNALS; //# sourceMappingURL=core.js.map /***/ }), -/* 251 */ +/* 267 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -25611,7 +28674,7 @@ const SIGRTMAX=64;exports.SIGRTMAX=SIGRTMAX; //# sourceMappingURL=realtime.js.map /***/ }), -/* 252 */ +/* 268 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -25670,13 +28733,13 @@ module.exports.node = opts => { /***/ }), -/* 253 */ +/* 269 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const os = __webpack_require__(121); -const onExit = __webpack_require__(218); +const os = __webpack_require__(120); +const onExit = __webpack_require__(225); const DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5; @@ -25789,14 +28852,14 @@ module.exports = { /***/ }), -/* 254 */ +/* 270 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const isStream = __webpack_require__(255); -const getStream = __webpack_require__(256); -const mergeStream = __webpack_require__(260); +const isStream = __webpack_require__(271); +const getStream = __webpack_require__(272); +const mergeStream = __webpack_require__(276); // `input` option const handleInput = (spawned, input) => { @@ -25893,7 +28956,7 @@ module.exports = { /***/ }), -/* 255 */ +/* 271 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -25929,13 +28992,13 @@ module.exports = isStream; /***/ }), -/* 256 */ +/* 272 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const pump = __webpack_require__(257); -const bufferStream = __webpack_require__(259); +const pump = __webpack_require__(273); +const bufferStream = __webpack_require__(275); class MaxBufferError extends Error { constructor() { @@ -25994,12 +29057,12 @@ module.exports.MaxBufferError = MaxBufferError; /***/ }), -/* 257 */ +/* 273 */ /***/ (function(module, exports, __webpack_require__) { -var once = __webpack_require__(160) -var eos = __webpack_require__(258) -var fs = __webpack_require__(132) // we only need fs to get the ReadStream and WriteStream prototypes +var once = __webpack_require__(161) +var eos = __webpack_require__(274) +var fs = __webpack_require__(133) // we only need fs to get the ReadStream and WriteStream prototypes var noop = function () {} var ancient = /^v?\.0/.test(process.version) @@ -26082,10 +29145,10 @@ module.exports = pump /***/ }), -/* 258 */ +/* 274 */ /***/ (function(module, exports, __webpack_require__) { -var once = __webpack_require__(160); +var once = __webpack_require__(161); var noop = function() {}; @@ -26175,12 +29238,12 @@ module.exports = eos; /***/ }), -/* 259 */ +/* 275 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const {PassThrough: PassThroughStream} = __webpack_require__(136); +const {PassThrough: PassThroughStream} = __webpack_require__(137); module.exports = options => { options = {...options}; @@ -26234,13 +29297,13 @@ module.exports = options => { /***/ }), -/* 260 */ +/* 276 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const { PassThrough } = __webpack_require__(136); +const { PassThrough } = __webpack_require__(137); module.exports = function (/*streams...*/) { var sources = [] @@ -26282,7 +29345,7 @@ module.exports = function (/*streams...*/) { /***/ }), -/* 261 */ +/* 277 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -26335,7 +29398,7 @@ module.exports = { /***/ }), -/* 262 */ +/* 278 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -26380,7 +29443,7 @@ module.exports = { /***/ }), -/* 263 */ +/* 279 */ /***/ (function(module, exports, __webpack_require__) { // Copyright IBM Corp. 2014,2018. All Rights Reserved. @@ -26388,12 +29451,12 @@ module.exports = { // This file is licensed under the Apache License 2.0. // License text available at https://opensource.org/licenses/Apache-2.0 -module.exports = __webpack_require__(264); -module.exports.cli = __webpack_require__(268); +module.exports = __webpack_require__(280); +module.exports.cli = __webpack_require__(284); /***/ }), -/* 264 */ +/* 280 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -26404,13 +29467,13 @@ module.exports.cli = __webpack_require__(268); -var stream = __webpack_require__(136); +var stream = __webpack_require__(137); var util = __webpack_require__(111); -var fs = __webpack_require__(132); +var fs = __webpack_require__(133); -var through = __webpack_require__(265); -var duplexer = __webpack_require__(266); -var StringDecoder = __webpack_require__(267).StringDecoder; +var through = __webpack_require__(281); +var duplexer = __webpack_require__(282); +var StringDecoder = __webpack_require__(283).StringDecoder; module.exports = Logger; @@ -26599,10 +29662,10 @@ function lineMerger(host) { /***/ }), -/* 265 */ +/* 281 */ /***/ (function(module, exports, __webpack_require__) { -var Stream = __webpack_require__(136) +var Stream = __webpack_require__(137) // through // @@ -26713,10 +29776,10 @@ function through (write, end, opts) { /***/ }), -/* 266 */ +/* 282 */ /***/ (function(module, exports, __webpack_require__) { -var Stream = __webpack_require__(136) +var Stream = __webpack_require__(137) var writeMethods = ["write", "end", "destroy"] var readMethods = ["resume", "pause"] var readEvents = ["data", "close"] @@ -26806,13 +29869,13 @@ function duplex(writer, reader) { /***/ }), -/* 267 */ +/* 283 */ /***/ (function(module, exports) { module.exports = require("string_decoder"); /***/ }), -/* 268 */ +/* 284 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -26823,11 +29886,11 @@ module.exports = require("string_decoder"); -var minimist = __webpack_require__(269); +var minimist = __webpack_require__(285); var path = __webpack_require__(4); -var Logger = __webpack_require__(264); -var pkg = __webpack_require__(270); +var Logger = __webpack_require__(280); +var pkg = __webpack_require__(286); module.exports = cli; @@ -26881,7 +29944,7 @@ function usage($0, p) { /***/ }), -/* 269 */ +/* 285 */ /***/ (function(module, exports) { module.exports = function (args, opts) { @@ -27123,29 +30186,29 @@ function isNumber (x) { /***/ }), -/* 270 */ +/* 286 */ /***/ (function(module) { module.exports = JSON.parse("{\"name\":\"strong-log-transformer\",\"version\":\"2.1.0\",\"description\":\"Stream transformer that prefixes lines with timestamps and other things.\",\"author\":\"Ryan Graham \",\"license\":\"Apache-2.0\",\"repository\":{\"type\":\"git\",\"url\":\"git://github.com/strongloop/strong-log-transformer\"},\"keywords\":[\"logging\",\"streams\"],\"bugs\":{\"url\":\"https://github.com/strongloop/strong-log-transformer/issues\"},\"homepage\":\"https://github.com/strongloop/strong-log-transformer\",\"directories\":{\"test\":\"test\"},\"bin\":{\"sl-log-transformer\":\"bin/sl-log-transformer.js\"},\"main\":\"index.js\",\"scripts\":{\"test\":\"tap --100 test/test-*\"},\"dependencies\":{\"duplexer\":\"^0.1.1\",\"minimist\":\"^1.2.0\",\"through\":\"^2.3.4\"},\"devDependencies\":{\"tap\":\"^12.0.1\"},\"engines\":{\"node\":\">=4\"}}"); /***/ }), -/* 271 */ +/* 287 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "workspacePackagePaths", function() { return workspacePackagePaths; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "copyWorkspacePackages", function() { return copyWorkspacePackages; }); -/* harmony import */ var glob__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(145); +/* harmony import */ var glob__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(146); /* harmony import */ var glob__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(glob__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(111); /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(util__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(272); -/* harmony import */ var _fs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(129); -/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(163); -/* harmony import */ var _projects__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(144); +/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(288); +/* harmony import */ var _fs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(130); +/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(164); +/* harmony import */ var _projects__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(145); /* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with @@ -27237,7 +30300,7 @@ function packagesFromGlobPattern({ } /***/ }), -/* 272 */ +/* 288 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -27307,21 +30370,21 @@ function getProjectPaths({ } /***/ }), -/* 273 */ +/* 289 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAllChecksums", function() { return getAllChecksums; }); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(132); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(133); /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(274); +/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(290); /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(111); /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(util__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var execa__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(228); +/* harmony import */ var execa__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(244); /* harmony import */ var execa__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(execa__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _yarn_lock__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(275); +/* harmony import */ var _yarn_lock__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(291); /* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with @@ -27550,21 +30613,21 @@ async function getAllChecksums(kbn, log) { } /***/ }), -/* 274 */ +/* 290 */ /***/ (function(module, exports) { module.exports = require("crypto"); /***/ }), -/* 275 */ +/* 291 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "readYarnLock", function() { return readYarnLock; }); -/* harmony import */ var _yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(276); +/* harmony import */ var _yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(292); /* harmony import */ var _yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _utils_fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(129); +/* harmony import */ var _utils_fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(130); /* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with @@ -27606,7 +30669,7 @@ async function readYarnLock(kbn) { } /***/ }), -/* 276 */ +/* 292 */ /***/ (function(module, exports, __webpack_require__) { module.exports = @@ -27738,7 +30801,7 @@ module.exports = __webpack_require__(111); /* 3 */ /***/ (function(module, exports) { -module.exports = __webpack_require__(132); +module.exports = __webpack_require__(133); /***/ }), /* 4 */ @@ -29165,7 +32228,7 @@ module.exports = invariant; /* 9 */ /***/ (function(module, exports) { -module.exports = __webpack_require__(274); +module.exports = __webpack_require__(290); /***/ }), /* 10 */, @@ -29591,7 +32654,7 @@ exports.default = Lockfile; /* 17 */ /***/ (function(module, exports) { -module.exports = __webpack_require__(136); +module.exports = __webpack_require__(137); /***/ }), /* 18 */, @@ -29643,7 +32706,7 @@ function nullify(obj = {}) { /* 22 */ /***/ (function(module, exports) { -module.exports = __webpack_require__(138); +module.exports = __webpack_require__(139); /***/ }), /* 23 */ @@ -29830,7 +32893,7 @@ module.exports = {}; /* 36 */ /***/ (function(module, exports) { -module.exports = __webpack_require__(121); +module.exports = __webpack_require__(120); /***/ }), /* 37 */, @@ -30115,7 +33178,7 @@ exports.f = __webpack_require__(33) ? Object.defineProperty : function definePro /* 54 */ /***/ (function(module, exports) { -module.exports = __webpack_require__(154); +module.exports = __webpack_require__(155); /***/ }), /* 55 */ @@ -31489,7 +34552,7 @@ function onceStrict (fn) { /* 63 */ /***/ (function(module, exports) { -module.exports = __webpack_require__(277); +module.exports = __webpack_require__(293); /***/ }), /* 64 */, @@ -32427,7 +35490,7 @@ module.exports.win32 = win32; /* 79 */ /***/ (function(module, exports) { -module.exports = __webpack_require__(278); +module.exports = __webpack_require__(121); /***/ }), /* 80 */, @@ -37884,25 +40947,19 @@ module.exports = process && support(supportLevel); /******/ ]); /***/ }), -/* 277 */ +/* 293 */ /***/ (function(module, exports) { module.exports = require("buffer"); /***/ }), -/* 278 */ -/***/ (function(module, exports) { - -module.exports = require("tty"); - -/***/ }), -/* 279 */ +/* 294 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BootstrapCacheFile", function() { return BootstrapCacheFile; }); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(132); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(133); /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); @@ -37993,20 +41050,20 @@ class BootstrapCacheFile { } /***/ }), -/* 280 */ +/* 295 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CleanCommand", function() { return CleanCommand; }); -/* harmony import */ var del__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(281); +/* harmony import */ var del__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(296); /* harmony import */ var del__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(del__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(373); +/* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(388); /* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(ora__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _utils_fs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(129); -/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(142); +/* harmony import */ var _utils_fs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(130); +/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(143); /* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with @@ -38101,21 +41158,21 @@ const CleanCommand = { }; /***/ }), -/* 281 */ +/* 296 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const {promisify} = __webpack_require__(111); const path = __webpack_require__(4); -const globby = __webpack_require__(282); -const isGlob = __webpack_require__(365); -const slash = __webpack_require__(363); -const gracefulFs = __webpack_require__(131); -const isPathCwd = __webpack_require__(366); -const isPathInside = __webpack_require__(367); -const rimraf = __webpack_require__(368); -const pMap = __webpack_require__(369); +const globby = __webpack_require__(297); +const isGlob = __webpack_require__(380); +const slash = __webpack_require__(378); +const gracefulFs = __webpack_require__(132); +const isPathCwd = __webpack_require__(381); +const isPathInside = __webpack_require__(382); +const rimraf = __webpack_require__(383); +const pMap = __webpack_require__(384); const rimrafP = promisify(rimraf); @@ -38229,19 +41286,19 @@ module.exports.sync = (patterns, {force, dryRun, cwd = process.cwd(), ...options /***/ }), -/* 282 */ +/* 297 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const fs = __webpack_require__(132); -const arrayUnion = __webpack_require__(283); -const merge2 = __webpack_require__(284); -const glob = __webpack_require__(285); -const fastGlob = __webpack_require__(290); -const dirGlob = __webpack_require__(359); -const gitignore = __webpack_require__(361); -const {FilterStream, UniqueStream} = __webpack_require__(364); +const fs = __webpack_require__(133); +const arrayUnion = __webpack_require__(298); +const merge2 = __webpack_require__(299); +const glob = __webpack_require__(300); +const fastGlob = __webpack_require__(305); +const dirGlob = __webpack_require__(374); +const gitignore = __webpack_require__(376); +const {FilterStream, UniqueStream} = __webpack_require__(379); const DEFAULT_FILTER = () => false; @@ -38414,7 +41471,7 @@ module.exports.gitignore = gitignore; /***/ }), -/* 283 */ +/* 298 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -38426,7 +41483,7 @@ module.exports = (...arguments_) => { /***/ }), -/* 284 */ +/* 299 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -38438,7 +41495,7 @@ module.exports = (...arguments_) => { * Copyright (c) 2014-2020 Teambition * Licensed under the MIT license. */ -const Stream = __webpack_require__(136) +const Stream = __webpack_require__(137) const PassThrough = Stream.PassThrough const slice = Array.prototype.slice @@ -38577,7 +41634,7 @@ function pauseStreams (streams, options) { /***/ }), -/* 285 */ +/* 300 */ /***/ (function(module, exports, __webpack_require__) { // Approach: @@ -38622,27 +41679,27 @@ function pauseStreams (streams, options) { module.exports = glob -var fs = __webpack_require__(132) -var rp = __webpack_require__(146) -var minimatch = __webpack_require__(148) +var fs = __webpack_require__(133) +var rp = __webpack_require__(147) +var minimatch = __webpack_require__(149) var Minimatch = minimatch.Minimatch -var inherits = __webpack_require__(286) -var EE = __webpack_require__(154).EventEmitter +var inherits = __webpack_require__(301) +var EE = __webpack_require__(155).EventEmitter var path = __webpack_require__(4) -var assert = __webpack_require__(138) -var isAbsolute = __webpack_require__(155) -var globSync = __webpack_require__(288) -var common = __webpack_require__(289) +var assert = __webpack_require__(139) +var isAbsolute = __webpack_require__(156) +var globSync = __webpack_require__(303) +var common = __webpack_require__(304) var alphasort = common.alphasort var alphasorti = common.alphasorti var setopts = common.setopts var ownProp = common.ownProp -var inflight = __webpack_require__(158) +var inflight = __webpack_require__(159) var util = __webpack_require__(111) var childrenIgnored = common.childrenIgnored var isIgnored = common.isIgnored -var once = __webpack_require__(160) +var once = __webpack_require__(161) function glob (pattern, options, cb) { if (typeof options === 'function') cb = options, options = {} @@ -39373,7 +42430,7 @@ Glob.prototype._stat2 = function (f, abs, er, stat, cb) { /***/ }), -/* 286 */ +/* 301 */ /***/ (function(module, exports, __webpack_require__) { try { @@ -39383,12 +42440,12 @@ try { module.exports = util.inherits; } catch (e) { /* istanbul ignore next */ - module.exports = __webpack_require__(287); + module.exports = __webpack_require__(302); } /***/ }), -/* 287 */ +/* 302 */ /***/ (function(module, exports) { if (typeof Object.create === 'function') { @@ -39421,22 +42478,22 @@ if (typeof Object.create === 'function') { /***/ }), -/* 288 */ +/* 303 */ /***/ (function(module, exports, __webpack_require__) { module.exports = globSync globSync.GlobSync = GlobSync -var fs = __webpack_require__(132) -var rp = __webpack_require__(146) -var minimatch = __webpack_require__(148) +var fs = __webpack_require__(133) +var rp = __webpack_require__(147) +var minimatch = __webpack_require__(149) var Minimatch = minimatch.Minimatch -var Glob = __webpack_require__(285).Glob +var Glob = __webpack_require__(300).Glob var util = __webpack_require__(111) var path = __webpack_require__(4) -var assert = __webpack_require__(138) -var isAbsolute = __webpack_require__(155) -var common = __webpack_require__(289) +var assert = __webpack_require__(139) +var isAbsolute = __webpack_require__(156) +var common = __webpack_require__(304) var alphasort = common.alphasort var alphasorti = common.alphasorti var setopts = common.setopts @@ -39913,7 +42970,7 @@ GlobSync.prototype._makeAbs = function (f) { /***/ }), -/* 289 */ +/* 304 */ /***/ (function(module, exports, __webpack_require__) { exports.alphasort = alphasort @@ -39931,8 +42988,8 @@ function ownProp (obj, field) { } var path = __webpack_require__(4) -var minimatch = __webpack_require__(148) -var isAbsolute = __webpack_require__(155) +var minimatch = __webpack_require__(149) +var isAbsolute = __webpack_require__(156) var Minimatch = minimatch.Minimatch function alphasorti (a, b) { @@ -40159,17 +43216,17 @@ function childrenIgnored (self, path) { /***/ }), -/* 290 */ +/* 305 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const taskManager = __webpack_require__(291); -const async_1 = __webpack_require__(320); -const stream_1 = __webpack_require__(355); -const sync_1 = __webpack_require__(356); -const settings_1 = __webpack_require__(358); -const utils = __webpack_require__(292); +const taskManager = __webpack_require__(306); +const async_1 = __webpack_require__(335); +const stream_1 = __webpack_require__(370); +const sync_1 = __webpack_require__(371); +const settings_1 = __webpack_require__(373); +const utils = __webpack_require__(307); async function FastGlob(source, options) { assertPatternsInput(source); const works = getWorks(source, async_1.default, options); @@ -40233,13 +43290,13 @@ module.exports = FastGlob; /***/ }), -/* 291 */ +/* 306 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(292); +const utils = __webpack_require__(307); function generate(patterns, settings) { const positivePatterns = getPositivePatterns(patterns); const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore); @@ -40304,30 +43361,30 @@ exports.convertPatternGroupToTask = convertPatternGroupToTask; /***/ }), -/* 292 */ +/* 307 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const array = __webpack_require__(293); +const array = __webpack_require__(308); exports.array = array; -const errno = __webpack_require__(294); +const errno = __webpack_require__(309); exports.errno = errno; -const fs = __webpack_require__(295); +const fs = __webpack_require__(310); exports.fs = fs; -const path = __webpack_require__(296); +const path = __webpack_require__(311); exports.path = path; -const pattern = __webpack_require__(297); +const pattern = __webpack_require__(312); exports.pattern = pattern; -const stream = __webpack_require__(318); +const stream = __webpack_require__(333); exports.stream = stream; -const string = __webpack_require__(319); +const string = __webpack_require__(334); exports.string = string; /***/ }), -/* 293 */ +/* 308 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -40355,7 +43412,7 @@ exports.splitWhen = splitWhen; /***/ }), -/* 294 */ +/* 309 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -40368,7 +43425,7 @@ exports.isEnoentCodeError = isEnoentCodeError; /***/ }), -/* 295 */ +/* 310 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -40393,7 +43450,7 @@ exports.createDirentFromStats = createDirentFromStats; /***/ }), -/* 296 */ +/* 311 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -40432,16 +43489,16 @@ exports.removeLeadingDotSegment = removeLeadingDotSegment; /***/ }), -/* 297 */ +/* 312 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const path = __webpack_require__(4); -const globParent = __webpack_require__(298); -const micromatch = __webpack_require__(301); -const picomatch = __webpack_require__(312); +const globParent = __webpack_require__(313); +const micromatch = __webpack_require__(316); +const picomatch = __webpack_require__(327); const GLOBSTAR = '**'; const ESCAPE_SYMBOL = '\\'; const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/; @@ -40551,15 +43608,15 @@ exports.matchAny = matchAny; /***/ }), -/* 298 */ +/* 313 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isGlob = __webpack_require__(299); +var isGlob = __webpack_require__(314); var pathPosixDirname = __webpack_require__(4).posix.dirname; -var isWin32 = __webpack_require__(121).platform() === 'win32'; +var isWin32 = __webpack_require__(120).platform() === 'win32'; var slash = '/'; var backslash = /\\/g; @@ -40599,7 +43656,7 @@ module.exports = function globParent(str, opts) { /***/ }), -/* 299 */ +/* 314 */ /***/ (function(module, exports, __webpack_require__) { /*! @@ -40609,7 +43666,7 @@ module.exports = function globParent(str, opts) { * Released under the MIT License. */ -var isExtglob = __webpack_require__(300); +var isExtglob = __webpack_require__(315); var chars = { '{': '}', '(': ')', '[': ']'}; var strictRegex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; var relaxedRegex = /\\(.)|(^!|[*?{}()[\]]|\(\?)/; @@ -40653,7 +43710,7 @@ module.exports = function isGlob(str, options) { /***/ }), -/* 300 */ +/* 315 */ /***/ (function(module, exports) { /*! @@ -40679,16 +43736,16 @@ module.exports = function isExtglob(str) { /***/ }), -/* 301 */ +/* 316 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const util = __webpack_require__(111); -const braces = __webpack_require__(302); -const picomatch = __webpack_require__(312); -const utils = __webpack_require__(315); +const braces = __webpack_require__(317); +const picomatch = __webpack_require__(327); +const utils = __webpack_require__(330); const isEmptyString = val => typeof val === 'string' && (val === '' || val === './'); /** @@ -41153,16 +44210,16 @@ module.exports = micromatch; /***/ }), -/* 302 */ +/* 317 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const stringify = __webpack_require__(303); -const compile = __webpack_require__(305); -const expand = __webpack_require__(309); -const parse = __webpack_require__(310); +const stringify = __webpack_require__(318); +const compile = __webpack_require__(320); +const expand = __webpack_require__(324); +const parse = __webpack_require__(325); /** * Expand the given pattern or create a regex-compatible string. @@ -41330,13 +44387,13 @@ module.exports = braces; /***/ }), -/* 303 */ +/* 318 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const utils = __webpack_require__(304); +const utils = __webpack_require__(319); module.exports = (ast, options = {}) => { let stringify = (node, parent = {}) => { @@ -41369,7 +44426,7 @@ module.exports = (ast, options = {}) => { /***/ }), -/* 304 */ +/* 319 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -41488,14 +44545,14 @@ exports.flatten = (...args) => { /***/ }), -/* 305 */ +/* 320 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const fill = __webpack_require__(306); -const utils = __webpack_require__(304); +const fill = __webpack_require__(321); +const utils = __webpack_require__(319); const compile = (ast, options = {}) => { let walk = (node, parent = {}) => { @@ -41552,7 +44609,7 @@ module.exports = compile; /***/ }), -/* 306 */ +/* 321 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -41566,7 +44623,7 @@ module.exports = compile; const util = __webpack_require__(111); -const toRegexRange = __webpack_require__(307); +const toRegexRange = __webpack_require__(322); const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); @@ -41808,7 +44865,7 @@ module.exports = fill; /***/ }), -/* 307 */ +/* 322 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -41821,7 +44878,7 @@ module.exports = fill; -const isNumber = __webpack_require__(308); +const isNumber = __webpack_require__(323); const toRegexRange = (min, max, options) => { if (isNumber(min) === false) { @@ -42103,7 +45160,7 @@ module.exports = toRegexRange; /***/ }), -/* 308 */ +/* 323 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -42128,15 +45185,15 @@ module.exports = function(num) { /***/ }), -/* 309 */ +/* 324 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const fill = __webpack_require__(306); -const stringify = __webpack_require__(303); -const utils = __webpack_require__(304); +const fill = __webpack_require__(321); +const stringify = __webpack_require__(318); +const utils = __webpack_require__(319); const append = (queue = '', stash = '', enclose = false) => { let result = []; @@ -42248,13 +45305,13 @@ module.exports = expand; /***/ }), -/* 310 */ +/* 325 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const stringify = __webpack_require__(303); +const stringify = __webpack_require__(318); /** * Constants @@ -42276,7 +45333,7 @@ const { CHAR_SINGLE_QUOTE, /* ' */ CHAR_NO_BREAK_SPACE, CHAR_ZERO_WIDTH_NOBREAK_SPACE -} = __webpack_require__(311); +} = __webpack_require__(326); /** * parse @@ -42588,7 +45645,7 @@ module.exports = parse; /***/ }), -/* 311 */ +/* 326 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -42652,27 +45709,27 @@ module.exports = { /***/ }), -/* 312 */ +/* 327 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -module.exports = __webpack_require__(313); +module.exports = __webpack_require__(328); /***/ }), -/* 313 */ +/* 328 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(4); -const scan = __webpack_require__(314); -const parse = __webpack_require__(317); -const utils = __webpack_require__(315); -const constants = __webpack_require__(316); +const scan = __webpack_require__(329); +const parse = __webpack_require__(332); +const utils = __webpack_require__(330); +const constants = __webpack_require__(331); const isObject = val => val && typeof val === 'object' && !Array.isArray(val); /** @@ -43008,13 +46065,13 @@ module.exports = picomatch; /***/ }), -/* 314 */ +/* 329 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const utils = __webpack_require__(315); +const utils = __webpack_require__(330); const { CHAR_ASTERISK, /* * */ CHAR_AT, /* @ */ @@ -43031,7 +46088,7 @@ const { CHAR_RIGHT_CURLY_BRACE, /* } */ CHAR_RIGHT_PARENTHESES, /* ) */ CHAR_RIGHT_SQUARE_BRACKET /* ] */ -} = __webpack_require__(316); +} = __webpack_require__(331); const isPathSeparator = code => { return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; @@ -43398,7 +46455,7 @@ module.exports = scan; /***/ }), -/* 315 */ +/* 330 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -43411,7 +46468,7 @@ const { REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL -} = __webpack_require__(316); +} = __webpack_require__(331); exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); @@ -43469,7 +46526,7 @@ exports.wrapOutput = (input, state = {}, options = {}) => { /***/ }), -/* 316 */ +/* 331 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -43655,14 +46712,14 @@ module.exports = { /***/ }), -/* 317 */ +/* 332 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const constants = __webpack_require__(316); -const utils = __webpack_require__(315); +const constants = __webpack_require__(331); +const utils = __webpack_require__(330); /** * Constants @@ -44740,13 +47797,13 @@ module.exports = parse; /***/ }), -/* 318 */ +/* 333 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const merge2 = __webpack_require__(284); +const merge2 = __webpack_require__(299); function merge(streams) { const mergedStream = merge2(streams); streams.forEach((stream) => { @@ -44763,7 +47820,7 @@ function propagateCloseEventToSources(streams) { /***/ }), -/* 319 */ +/* 334 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -44780,14 +47837,14 @@ exports.isEmpty = isEmpty; /***/ }), -/* 320 */ +/* 335 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const stream_1 = __webpack_require__(321); -const provider_1 = __webpack_require__(348); +const stream_1 = __webpack_require__(336); +const provider_1 = __webpack_require__(363); class ProviderAsync extends provider_1.default { constructor() { super(...arguments); @@ -44815,16 +47872,16 @@ exports.default = ProviderAsync; /***/ }), -/* 321 */ +/* 336 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const stream_1 = __webpack_require__(136); -const fsStat = __webpack_require__(322); -const fsWalk = __webpack_require__(327); -const reader_1 = __webpack_require__(347); +const stream_1 = __webpack_require__(137); +const fsStat = __webpack_require__(337); +const fsWalk = __webpack_require__(342); +const reader_1 = __webpack_require__(362); class ReaderStream extends reader_1.default { constructor() { super(...arguments); @@ -44877,15 +47934,15 @@ exports.default = ReaderStream; /***/ }), -/* 322 */ +/* 337 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const async = __webpack_require__(323); -const sync = __webpack_require__(324); -const settings_1 = __webpack_require__(325); +const async = __webpack_require__(338); +const sync = __webpack_require__(339); +const settings_1 = __webpack_require__(340); exports.Settings = settings_1.default; function stat(path, optionsOrSettingsOrCallback, callback) { if (typeof optionsOrSettingsOrCallback === 'function') { @@ -44908,7 +47965,7 @@ function getSettings(settingsOrOptions = {}) { /***/ }), -/* 323 */ +/* 338 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -44946,7 +48003,7 @@ function callSuccessCallback(callback, result) { /***/ }), -/* 324 */ +/* 339 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -44975,13 +48032,13 @@ exports.read = read; /***/ }), -/* 325 */ +/* 340 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fs = __webpack_require__(326); +const fs = __webpack_require__(341); class Settings { constructor(_options = {}) { this._options = _options; @@ -44998,13 +48055,13 @@ exports.default = Settings; /***/ }), -/* 326 */ +/* 341 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fs = __webpack_require__(132); +const fs = __webpack_require__(133); exports.FILE_SYSTEM_ADAPTER = { lstat: fs.lstat, stat: fs.stat, @@ -45021,16 +48078,16 @@ exports.createFileSystemAdapter = createFileSystemAdapter; /***/ }), -/* 327 */ +/* 342 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const async_1 = __webpack_require__(328); -const stream_1 = __webpack_require__(343); -const sync_1 = __webpack_require__(344); -const settings_1 = __webpack_require__(346); +const async_1 = __webpack_require__(343); +const stream_1 = __webpack_require__(358); +const sync_1 = __webpack_require__(359); +const settings_1 = __webpack_require__(361); exports.Settings = settings_1.default; function walk(directory, optionsOrSettingsOrCallback, callback) { if (typeof optionsOrSettingsOrCallback === 'function') { @@ -45060,13 +48117,13 @@ function getSettings(settingsOrOptions = {}) { /***/ }), -/* 328 */ +/* 343 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const async_1 = __webpack_require__(329); +const async_1 = __webpack_require__(344); class AsyncProvider { constructor(_root, _settings) { this._root = _root; @@ -45097,17 +48154,17 @@ function callSuccessCallback(callback, entries) { /***/ }), -/* 329 */ +/* 344 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const events_1 = __webpack_require__(154); -const fsScandir = __webpack_require__(330); -const fastq = __webpack_require__(339); -const common = __webpack_require__(341); -const reader_1 = __webpack_require__(342); +const events_1 = __webpack_require__(155); +const fsScandir = __webpack_require__(345); +const fastq = __webpack_require__(354); +const common = __webpack_require__(356); +const reader_1 = __webpack_require__(357); class AsyncReader extends reader_1.default { constructor(_root, _settings) { super(_root, _settings); @@ -45197,15 +48254,15 @@ exports.default = AsyncReader; /***/ }), -/* 330 */ +/* 345 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const async = __webpack_require__(331); -const sync = __webpack_require__(336); -const settings_1 = __webpack_require__(337); +const async = __webpack_require__(346); +const sync = __webpack_require__(351); +const settings_1 = __webpack_require__(352); exports.Settings = settings_1.default; function scandir(path, optionsOrSettingsOrCallback, callback) { if (typeof optionsOrSettingsOrCallback === 'function') { @@ -45228,16 +48285,16 @@ function getSettings(settingsOrOptions = {}) { /***/ }), -/* 331 */ +/* 346 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fsStat = __webpack_require__(322); -const rpl = __webpack_require__(332); -const constants_1 = __webpack_require__(333); -const utils = __webpack_require__(334); +const fsStat = __webpack_require__(337); +const rpl = __webpack_require__(347); +const constants_1 = __webpack_require__(348); +const utils = __webpack_require__(349); function read(directory, settings, callback) { if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { return readdirWithFileTypes(directory, settings, callback); @@ -45325,7 +48382,7 @@ function callSuccessCallback(callback, result) { /***/ }), -/* 332 */ +/* 347 */ /***/ (function(module, exports) { module.exports = runParallel @@ -45379,7 +48436,7 @@ function runParallel (tasks, cb) { /***/ }), -/* 333 */ +/* 348 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -45399,18 +48456,18 @@ exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_B /***/ }), -/* 334 */ +/* 349 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fs = __webpack_require__(335); +const fs = __webpack_require__(350); exports.fs = fs; /***/ }), -/* 335 */ +/* 350 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -45435,15 +48492,15 @@ exports.createDirentFromStats = createDirentFromStats; /***/ }), -/* 336 */ +/* 351 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fsStat = __webpack_require__(322); -const constants_1 = __webpack_require__(333); -const utils = __webpack_require__(334); +const fsStat = __webpack_require__(337); +const constants_1 = __webpack_require__(348); +const utils = __webpack_require__(349); function read(directory, settings) { if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { return readdirWithFileTypes(directory, settings); @@ -45494,15 +48551,15 @@ exports.readdir = readdir; /***/ }), -/* 337 */ +/* 352 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const path = __webpack_require__(4); -const fsStat = __webpack_require__(322); -const fs = __webpack_require__(338); +const fsStat = __webpack_require__(337); +const fs = __webpack_require__(353); class Settings { constructor(_options = {}) { this._options = _options; @@ -45525,13 +48582,13 @@ exports.default = Settings; /***/ }), -/* 338 */ +/* 353 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fs = __webpack_require__(132); +const fs = __webpack_require__(133); exports.FILE_SYSTEM_ADAPTER = { lstat: fs.lstat, stat: fs.stat, @@ -45550,13 +48607,13 @@ exports.createFileSystemAdapter = createFileSystemAdapter; /***/ }), -/* 339 */ +/* 354 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var reusify = __webpack_require__(340) +var reusify = __webpack_require__(355) function fastqueue (context, worker, concurrency) { if (typeof context === 'function') { @@ -45730,7 +48787,7 @@ module.exports = fastqueue /***/ }), -/* 340 */ +/* 355 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -45770,7 +48827,7 @@ module.exports = reusify /***/ }), -/* 341 */ +/* 356 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -45801,13 +48858,13 @@ exports.joinPathSegments = joinPathSegments; /***/ }), -/* 342 */ +/* 357 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const common = __webpack_require__(341); +const common = __webpack_require__(356); class Reader { constructor(_root, _settings) { this._root = _root; @@ -45819,14 +48876,14 @@ exports.default = Reader; /***/ }), -/* 343 */ +/* 358 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const stream_1 = __webpack_require__(136); -const async_1 = __webpack_require__(329); +const stream_1 = __webpack_require__(137); +const async_1 = __webpack_require__(344); class StreamProvider { constructor(_root, _settings) { this._root = _root; @@ -45856,13 +48913,13 @@ exports.default = StreamProvider; /***/ }), -/* 344 */ +/* 359 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const sync_1 = __webpack_require__(345); +const sync_1 = __webpack_require__(360); class SyncProvider { constructor(_root, _settings) { this._root = _root; @@ -45877,15 +48934,15 @@ exports.default = SyncProvider; /***/ }), -/* 345 */ +/* 360 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fsScandir = __webpack_require__(330); -const common = __webpack_require__(341); -const reader_1 = __webpack_require__(342); +const fsScandir = __webpack_require__(345); +const common = __webpack_require__(356); +const reader_1 = __webpack_require__(357); class SyncReader extends reader_1.default { constructor() { super(...arguments); @@ -45943,14 +49000,14 @@ exports.default = SyncReader; /***/ }), -/* 346 */ +/* 361 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const path = __webpack_require__(4); -const fsScandir = __webpack_require__(330); +const fsScandir = __webpack_require__(345); class Settings { constructor(_options = {}) { this._options = _options; @@ -45976,15 +49033,15 @@ exports.default = Settings; /***/ }), -/* 347 */ +/* 362 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const path = __webpack_require__(4); -const fsStat = __webpack_require__(322); -const utils = __webpack_require__(292); +const fsStat = __webpack_require__(337); +const utils = __webpack_require__(307); class Reader { constructor(_settings) { this._settings = _settings; @@ -46016,17 +49073,17 @@ exports.default = Reader; /***/ }), -/* 348 */ +/* 363 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const path = __webpack_require__(4); -const deep_1 = __webpack_require__(349); -const entry_1 = __webpack_require__(352); -const error_1 = __webpack_require__(353); -const entry_2 = __webpack_require__(354); +const deep_1 = __webpack_require__(364); +const entry_1 = __webpack_require__(367); +const error_1 = __webpack_require__(368); +const entry_2 = __webpack_require__(369); class Provider { constructor(_settings) { this._settings = _settings; @@ -46071,14 +49128,14 @@ exports.default = Provider; /***/ }), -/* 349 */ +/* 364 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(292); -const partial_1 = __webpack_require__(350); +const utils = __webpack_require__(307); +const partial_1 = __webpack_require__(365); class DeepFilter { constructor(_settings, _micromatchOptions) { this._settings = _settings; @@ -46132,13 +49189,13 @@ exports.default = DeepFilter; /***/ }), -/* 350 */ +/* 365 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const matcher_1 = __webpack_require__(351); +const matcher_1 = __webpack_require__(366); class PartialMatcher extends matcher_1.default { match(filepath) { const parts = filepath.split('/'); @@ -46177,13 +49234,13 @@ exports.default = PartialMatcher; /***/ }), -/* 351 */ +/* 366 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(292); +const utils = __webpack_require__(307); class Matcher { constructor(_patterns, _settings, _micromatchOptions) { this._patterns = _patterns; @@ -46234,13 +49291,13 @@ exports.default = Matcher; /***/ }), -/* 352 */ +/* 367 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(292); +const utils = __webpack_require__(307); class EntryFilter { constructor(_settings, _micromatchOptions) { this._settings = _settings; @@ -46296,13 +49353,13 @@ exports.default = EntryFilter; /***/ }), -/* 353 */ +/* 368 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(292); +const utils = __webpack_require__(307); class ErrorFilter { constructor(_settings) { this._settings = _settings; @@ -46318,13 +49375,13 @@ exports.default = ErrorFilter; /***/ }), -/* 354 */ +/* 369 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(292); +const utils = __webpack_require__(307); class EntryTransformer { constructor(_settings) { this._settings = _settings; @@ -46351,15 +49408,15 @@ exports.default = EntryTransformer; /***/ }), -/* 355 */ +/* 370 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const stream_1 = __webpack_require__(136); -const stream_2 = __webpack_require__(321); -const provider_1 = __webpack_require__(348); +const stream_1 = __webpack_require__(137); +const stream_2 = __webpack_require__(336); +const provider_1 = __webpack_require__(363); class ProviderStream extends provider_1.default { constructor() { super(...arguments); @@ -46389,14 +49446,14 @@ exports.default = ProviderStream; /***/ }), -/* 356 */ +/* 371 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const sync_1 = __webpack_require__(357); -const provider_1 = __webpack_require__(348); +const sync_1 = __webpack_require__(372); +const provider_1 = __webpack_require__(363); class ProviderSync extends provider_1.default { constructor() { super(...arguments); @@ -46419,15 +49476,15 @@ exports.default = ProviderSync; /***/ }), -/* 357 */ +/* 372 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fsStat = __webpack_require__(322); -const fsWalk = __webpack_require__(327); -const reader_1 = __webpack_require__(347); +const fsStat = __webpack_require__(337); +const fsWalk = __webpack_require__(342); +const reader_1 = __webpack_require__(362); class ReaderSync extends reader_1.default { constructor() { super(...arguments); @@ -46469,14 +49526,14 @@ exports.default = ReaderSync; /***/ }), -/* 358 */ +/* 373 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fs = __webpack_require__(132); -const os = __webpack_require__(121); +const fs = __webpack_require__(133); +const os = __webpack_require__(120); const CPU_COUNT = os.cpus().length; exports.DEFAULT_FILE_SYSTEM_ADAPTER = { lstat: fs.lstat, @@ -46528,13 +49585,13 @@ exports.default = Settings; /***/ }), -/* 359 */ +/* 374 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(4); -const pathType = __webpack_require__(360); +const pathType = __webpack_require__(375); const getExtensions = extensions => extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0]; @@ -46610,13 +49667,13 @@ module.exports.sync = (input, options) => { /***/ }), -/* 360 */ +/* 375 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const {promisify} = __webpack_require__(111); -const fs = __webpack_require__(132); +const fs = __webpack_require__(133); async function isType(fsStatType, statsMethodName, filePath) { if (typeof filePath !== 'string') { @@ -46660,17 +49717,17 @@ exports.isSymlinkSync = isTypeSync.bind(null, 'lstatSync', 'isSymbolicLink'); /***/ }), -/* 361 */ +/* 376 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const {promisify} = __webpack_require__(111); -const fs = __webpack_require__(132); +const fs = __webpack_require__(133); const path = __webpack_require__(4); -const fastGlob = __webpack_require__(290); -const gitIgnore = __webpack_require__(362); -const slash = __webpack_require__(363); +const fastGlob = __webpack_require__(305); +const gitIgnore = __webpack_require__(377); +const slash = __webpack_require__(378); const DEFAULT_IGNORE = [ '**/node_modules/**', @@ -46784,7 +49841,7 @@ module.exports.sync = options => { /***/ }), -/* 362 */ +/* 377 */ /***/ (function(module, exports) { // A simple implementation of make-array @@ -47387,7 +50444,7 @@ if ( /***/ }), -/* 363 */ +/* 378 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -47405,12 +50462,12 @@ module.exports = path => { /***/ }), -/* 364 */ +/* 379 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const {Transform} = __webpack_require__(136); +const {Transform} = __webpack_require__(137); class ObjectTransform extends Transform { constructor() { @@ -47458,7 +50515,7 @@ module.exports = { /***/ }), -/* 365 */ +/* 380 */ /***/ (function(module, exports, __webpack_require__) { /*! @@ -47468,7 +50525,7 @@ module.exports = { * Released under the MIT License. */ -var isExtglob = __webpack_require__(300); +var isExtglob = __webpack_require__(315); var chars = { '{': '}', '(': ')', '[': ']'}; var strictRegex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; var relaxedRegex = /\\(.)|(^!|[*?{}()[\]]|\(\?)/; @@ -47512,7 +50569,7 @@ module.exports = function isGlob(str, options) { /***/ }), -/* 366 */ +/* 381 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -47534,7 +50591,7 @@ module.exports = path_ => { /***/ }), -/* 367 */ +/* 382 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -47562,15 +50619,15 @@ module.exports = (childPath, parentPath) => { /***/ }), -/* 368 */ +/* 383 */ /***/ (function(module, exports, __webpack_require__) { -const assert = __webpack_require__(138) +const assert = __webpack_require__(139) const path = __webpack_require__(4) -const fs = __webpack_require__(132) +const fs = __webpack_require__(133) let glob = undefined try { - glob = __webpack_require__(285) + glob = __webpack_require__(300) } catch (_err) { // treat glob as optional. } @@ -47936,12 +50993,12 @@ rimraf.sync = rimrafSync /***/ }), -/* 369 */ +/* 384 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const AggregateError = __webpack_require__(370); +const AggregateError = __webpack_require__(385); module.exports = async ( iterable, @@ -48024,13 +51081,13 @@ module.exports = async ( /***/ }), -/* 370 */ +/* 385 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const indentString = __webpack_require__(371); -const cleanStack = __webpack_require__(372); +const indentString = __webpack_require__(386); +const cleanStack = __webpack_require__(387); const cleanInternalStack = stack => stack.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, ''); @@ -48078,7 +51135,7 @@ module.exports = AggregateError; /***/ }), -/* 371 */ +/* 386 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -48120,12 +51177,12 @@ module.exports = (string, count = 1, options) => { /***/ }), -/* 372 */ +/* 387 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const os = __webpack_require__(121); +const os = __webpack_require__(120); const extractPathRegex = /\s+at.*(?:\(|\s)(.*)\)?/; const pathRegex = /^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/; @@ -48167,15 +51224,15 @@ module.exports = (stack, options) => { /***/ }), -/* 373 */ +/* 388 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const chalk = __webpack_require__(374); -const cliCursor = __webpack_require__(378); -const cliSpinners = __webpack_require__(382); -const logSymbols = __webpack_require__(384); +const chalk = __webpack_require__(389); +const cliCursor = __webpack_require__(392); +const cliSpinners = __webpack_require__(396); +const logSymbols = __webpack_require__(398); class Ora { constructor(options) { @@ -48322,16 +51379,16 @@ module.exports.promise = (action, options) => { /***/ }), -/* 374 */ +/* 389 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const escapeStringRegexp = __webpack_require__(113); -const ansiStyles = __webpack_require__(375); -const stdoutColor = __webpack_require__(376).stdout; +const escapeStringRegexp = __webpack_require__(178); +const ansiStyles = __webpack_require__(390); +const stdoutColor = __webpack_require__(184).stdout; -const template = __webpack_require__(377); +const template = __webpack_require__(391); const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); @@ -48557,12 +51614,12 @@ module.exports.default = module.exports; // For TypeScript /***/ }), -/* 375 */ +/* 390 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(module) { -const colorConvert = __webpack_require__(116); +const colorConvert = __webpack_require__(180); const wrapAnsi16 = (fn, offset) => function () { const code = fn.apply(colorConvert, arguments); @@ -48727,152 +51784,10 @@ Object.defineProperty(module, 'exports', { get: assembleStyles }); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(115)(module))) - -/***/ }), -/* 376 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -const os = __webpack_require__(121); -const hasFlag = __webpack_require__(122); - -const env = process.env; - -let forceColor; -if (hasFlag('no-color') || - hasFlag('no-colors') || - hasFlag('color=false')) { - forceColor = false; -} else if (hasFlag('color') || - hasFlag('colors') || - hasFlag('color=true') || - hasFlag('color=always')) { - forceColor = true; -} -if ('FORCE_COLOR' in env) { - forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0; -} - -function translateLevel(level) { - if (level === 0) { - return false; - } - - return { - level, - hasBasic: true, - has256: level >= 2, - has16m: level >= 3 - }; -} - -function supportsColor(stream) { - if (forceColor === false) { - return 0; - } - - if (hasFlag('color=16m') || - hasFlag('color=full') || - hasFlag('color=truecolor')) { - return 3; - } - - if (hasFlag('color=256')) { - return 2; - } - - if (stream && !stream.isTTY && forceColor !== true) { - // VS code debugger doesn't have isTTY set - if (env.VSCODE_PID) { - return 1; - } - return 0; - } - - const min = forceColor ? 1 : 0; - - if (process.platform === 'win32') { - // Node.js 7.5.0 is the first version of Node.js to include a patch to - // libuv that enables 256 color output on Windows. Anything earlier and it - // won't work. However, here we target Node.js 8 at minimum as it is an LTS - // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows - // release that supports 256 colors. Windows 10 build 14931 is the first release - // that supports 16m/TrueColor. - const osRelease = os.release().split('.'); - if ( - Number(process.versions.node.split('.')[0]) >= 8 && - Number(osRelease[0]) >= 10 && - Number(osRelease[2]) >= 10586 - ) { - return Number(osRelease[2]) >= 14931 ? 3 : 2; - } - - return 1; - } - - if ('CI' in env) { - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { - return 1; - } - - return min; - } - - if ('TEAMCITY_VERSION' in env) { - return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; - } - - if (env.COLORTERM === 'truecolor') { - return 3; - } - - if ('TERM_PROGRAM' in env) { - const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); - - switch (env.TERM_PROGRAM) { - case 'iTerm.app': - return version >= 3 ? 3 : 2; - case 'Apple_Terminal': - return 2; - // No default - } - } - - if (/-256(color)?$/i.test(env.TERM)) { - return 2; - } - - if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { - return 1; - } - - if ('COLORTERM' in env) { - return 1; - } - - if (env.TERM === 'dumb') { - return min; - } - - return min; -} - -function getSupportLevel(stream) { - const level = supportsColor(stream); - return translateLevel(level); -} - -module.exports = { - supportsColor: getSupportLevel, - stdout: getSupportLevel(process.stdout), - stderr: getSupportLevel(process.stderr) -}; - +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(114)(module))) /***/ }), -/* 377 */ +/* 391 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -49007,12 +51922,12 @@ module.exports = (chalk, tmp) => { /***/ }), -/* 378 */ +/* 392 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const restoreCursor = __webpack_require__(379); +const restoreCursor = __webpack_require__(393); let hidden = false; @@ -49053,13 +51968,13 @@ exports.toggle = (force, stream) => { /***/ }), -/* 379 */ +/* 393 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const onetime = __webpack_require__(380); -const signalExit = __webpack_require__(218); +const onetime = __webpack_require__(394); +const signalExit = __webpack_require__(225); module.exports = onetime(() => { signalExit(() => { @@ -49069,12 +51984,12 @@ module.exports = onetime(() => { /***/ }), -/* 380 */ +/* 394 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const mimicFn = __webpack_require__(381); +const mimicFn = __webpack_require__(395); module.exports = (fn, opts) => { // TODO: Remove this in v3 @@ -49115,7 +52030,7 @@ module.exports = (fn, opts) => { /***/ }), -/* 381 */ +/* 395 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -49131,27 +52046,27 @@ module.exports = (to, from) => { /***/ }), -/* 382 */ +/* 396 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -module.exports = __webpack_require__(383); +module.exports = __webpack_require__(397); /***/ }), -/* 383 */ +/* 397 */ /***/ (function(module) { module.exports = JSON.parse("{\"dots\":{\"interval\":80,\"frames\":[\"⠋\",\"⠙\",\"⠹\",\"⠸\",\"⠼\",\"⠴\",\"⠦\",\"⠧\",\"⠇\",\"⠏\"]},\"dots2\":{\"interval\":80,\"frames\":[\"⣾\",\"⣽\",\"⣻\",\"⢿\",\"⡿\",\"⣟\",\"⣯\",\"⣷\"]},\"dots3\":{\"interval\":80,\"frames\":[\"⠋\",\"⠙\",\"⠚\",\"⠞\",\"⠖\",\"⠦\",\"⠴\",\"⠲\",\"⠳\",\"⠓\"]},\"dots4\":{\"interval\":80,\"frames\":[\"⠄\",\"⠆\",\"⠇\",\"⠋\",\"⠙\",\"⠸\",\"⠰\",\"⠠\",\"⠰\",\"⠸\",\"⠙\",\"⠋\",\"⠇\",\"⠆\"]},\"dots5\":{\"interval\":80,\"frames\":[\"⠋\",\"⠙\",\"⠚\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠲\",\"⠴\",\"⠦\",\"⠖\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠓\",\"⠋\"]},\"dots6\":{\"interval\":80,\"frames\":[\"⠁\",\"⠉\",\"⠙\",\"⠚\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠲\",\"⠴\",\"⠤\",\"⠄\",\"⠄\",\"⠤\",\"⠴\",\"⠲\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠚\",\"⠙\",\"⠉\",\"⠁\"]},\"dots7\":{\"interval\":80,\"frames\":[\"⠈\",\"⠉\",\"⠋\",\"⠓\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠖\",\"⠦\",\"⠤\",\"⠠\",\"⠠\",\"⠤\",\"⠦\",\"⠖\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠓\",\"⠋\",\"⠉\",\"⠈\"]},\"dots8\":{\"interval\":80,\"frames\":[\"⠁\",\"⠁\",\"⠉\",\"⠙\",\"⠚\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠲\",\"⠴\",\"⠤\",\"⠄\",\"⠄\",\"⠤\",\"⠠\",\"⠠\",\"⠤\",\"⠦\",\"⠖\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠓\",\"⠋\",\"⠉\",\"⠈\",\"⠈\"]},\"dots9\":{\"interval\":80,\"frames\":[\"⢹\",\"⢺\",\"⢼\",\"⣸\",\"⣇\",\"⡧\",\"⡗\",\"⡏\"]},\"dots10\":{\"interval\":80,\"frames\":[\"⢄\",\"⢂\",\"⢁\",\"⡁\",\"⡈\",\"⡐\",\"⡠\"]},\"dots11\":{\"interval\":100,\"frames\":[\"⠁\",\"⠂\",\"⠄\",\"⡀\",\"⢀\",\"⠠\",\"⠐\",\"⠈\"]},\"dots12\":{\"interval\":80,\"frames\":[\"⢀⠀\",\"⡀⠀\",\"⠄⠀\",\"⢂⠀\",\"⡂⠀\",\"⠅⠀\",\"⢃⠀\",\"⡃⠀\",\"⠍⠀\",\"⢋⠀\",\"⡋⠀\",\"⠍⠁\",\"⢋⠁\",\"⡋⠁\",\"⠍⠉\",\"⠋⠉\",\"⠋⠉\",\"⠉⠙\",\"⠉⠙\",\"⠉⠩\",\"⠈⢙\",\"⠈⡙\",\"⢈⠩\",\"⡀⢙\",\"⠄⡙\",\"⢂⠩\",\"⡂⢘\",\"⠅⡘\",\"⢃⠨\",\"⡃⢐\",\"⠍⡐\",\"⢋⠠\",\"⡋⢀\",\"⠍⡁\",\"⢋⠁\",\"⡋⠁\",\"⠍⠉\",\"⠋⠉\",\"⠋⠉\",\"⠉⠙\",\"⠉⠙\",\"⠉⠩\",\"⠈⢙\",\"⠈⡙\",\"⠈⠩\",\"⠀⢙\",\"⠀⡙\",\"⠀⠩\",\"⠀⢘\",\"⠀⡘\",\"⠀⠨\",\"⠀⢐\",\"⠀⡐\",\"⠀⠠\",\"⠀⢀\",\"⠀⡀\"]},\"line\":{\"interval\":130,\"frames\":[\"-\",\"\\\\\",\"|\",\"/\"]},\"line2\":{\"interval\":100,\"frames\":[\"⠂\",\"-\",\"–\",\"—\",\"–\",\"-\"]},\"pipe\":{\"interval\":100,\"frames\":[\"┤\",\"┘\",\"┴\",\"└\",\"├\",\"┌\",\"┬\",\"┐\"]},\"simpleDots\":{\"interval\":400,\"frames\":[\". \",\".. \",\"...\",\" \"]},\"simpleDotsScrolling\":{\"interval\":200,\"frames\":[\". \",\".. \",\"...\",\" ..\",\" .\",\" \"]},\"star\":{\"interval\":70,\"frames\":[\"✶\",\"✸\",\"✹\",\"✺\",\"✹\",\"✷\"]},\"star2\":{\"interval\":80,\"frames\":[\"+\",\"x\",\"*\"]},\"flip\":{\"interval\":70,\"frames\":[\"_\",\"_\",\"_\",\"-\",\"`\",\"`\",\"'\",\"´\",\"-\",\"_\",\"_\",\"_\"]},\"hamburger\":{\"interval\":100,\"frames\":[\"☱\",\"☲\",\"☴\"]},\"growVertical\":{\"interval\":120,\"frames\":[\"▁\",\"▃\",\"▄\",\"▅\",\"▆\",\"▇\",\"▆\",\"▅\",\"▄\",\"▃\"]},\"growHorizontal\":{\"interval\":120,\"frames\":[\"▏\",\"▎\",\"▍\",\"▌\",\"▋\",\"▊\",\"▉\",\"▊\",\"▋\",\"▌\",\"▍\",\"▎\"]},\"balloon\":{\"interval\":140,\"frames\":[\" \",\".\",\"o\",\"O\",\"@\",\"*\",\" \"]},\"balloon2\":{\"interval\":120,\"frames\":[\".\",\"o\",\"O\",\"°\",\"O\",\"o\",\".\"]},\"noise\":{\"interval\":100,\"frames\":[\"▓\",\"▒\",\"░\"]},\"bounce\":{\"interval\":120,\"frames\":[\"⠁\",\"⠂\",\"⠄\",\"⠂\"]},\"boxBounce\":{\"interval\":120,\"frames\":[\"▖\",\"▘\",\"▝\",\"▗\"]},\"boxBounce2\":{\"interval\":100,\"frames\":[\"▌\",\"▀\",\"▐\",\"▄\"]},\"triangle\":{\"interval\":50,\"frames\":[\"◢\",\"◣\",\"◤\",\"◥\"]},\"arc\":{\"interval\":100,\"frames\":[\"◜\",\"◠\",\"◝\",\"◞\",\"◡\",\"◟\"]},\"circle\":{\"interval\":120,\"frames\":[\"◡\",\"⊙\",\"◠\"]},\"squareCorners\":{\"interval\":180,\"frames\":[\"◰\",\"◳\",\"◲\",\"◱\"]},\"circleQuarters\":{\"interval\":120,\"frames\":[\"◴\",\"◷\",\"◶\",\"◵\"]},\"circleHalves\":{\"interval\":50,\"frames\":[\"◐\",\"◓\",\"◑\",\"◒\"]},\"squish\":{\"interval\":100,\"frames\":[\"╫\",\"╪\"]},\"toggle\":{\"interval\":250,\"frames\":[\"⊶\",\"⊷\"]},\"toggle2\":{\"interval\":80,\"frames\":[\"▫\",\"▪\"]},\"toggle3\":{\"interval\":120,\"frames\":[\"□\",\"■\"]},\"toggle4\":{\"interval\":100,\"frames\":[\"■\",\"□\",\"▪\",\"▫\"]},\"toggle5\":{\"interval\":100,\"frames\":[\"▮\",\"▯\"]},\"toggle6\":{\"interval\":300,\"frames\":[\"ဝ\",\"၀\"]},\"toggle7\":{\"interval\":80,\"frames\":[\"⦾\",\"⦿\"]},\"toggle8\":{\"interval\":100,\"frames\":[\"◍\",\"◌\"]},\"toggle9\":{\"interval\":100,\"frames\":[\"◉\",\"◎\"]},\"toggle10\":{\"interval\":100,\"frames\":[\"㊂\",\"㊀\",\"㊁\"]},\"toggle11\":{\"interval\":50,\"frames\":[\"⧇\",\"⧆\"]},\"toggle12\":{\"interval\":120,\"frames\":[\"☗\",\"☖\"]},\"toggle13\":{\"interval\":80,\"frames\":[\"=\",\"*\",\"-\"]},\"arrow\":{\"interval\":100,\"frames\":[\"←\",\"↖\",\"↑\",\"↗\",\"→\",\"↘\",\"↓\",\"↙\"]},\"arrow2\":{\"interval\":80,\"frames\":[\"⬆️ \",\"↗️ \",\"➡️ \",\"↘️ \",\"⬇️ \",\"↙️ \",\"⬅️ \",\"↖️ \"]},\"arrow3\":{\"interval\":120,\"frames\":[\"▹▹▹▹▹\",\"▸▹▹▹▹\",\"▹▸▹▹▹\",\"▹▹▸▹▹\",\"▹▹▹▸▹\",\"▹▹▹▹▸\"]},\"bouncingBar\":{\"interval\":80,\"frames\":[\"[ ]\",\"[= ]\",\"[== ]\",\"[=== ]\",\"[ ===]\",\"[ ==]\",\"[ =]\",\"[ ]\",\"[ =]\",\"[ ==]\",\"[ ===]\",\"[====]\",\"[=== ]\",\"[== ]\",\"[= ]\"]},\"bouncingBall\":{\"interval\":80,\"frames\":[\"( ● )\",\"( ● )\",\"( ● )\",\"( ● )\",\"( ●)\",\"( ● )\",\"( ● )\",\"( ● )\",\"( ● )\",\"(● )\"]},\"smiley\":{\"interval\":200,\"frames\":[\"😄 \",\"😝 \"]},\"monkey\":{\"interval\":300,\"frames\":[\"🙈 \",\"🙈 \",\"🙉 \",\"🙊 \"]},\"hearts\":{\"interval\":100,\"frames\":[\"💛 \",\"💙 \",\"💜 \",\"💚 \",\"❤️ \"]},\"clock\":{\"interval\":100,\"frames\":[\"🕐 \",\"🕑 \",\"🕒 \",\"🕓 \",\"🕔 \",\"🕕 \",\"🕖 \",\"🕗 \",\"🕘 \",\"🕙 \",\"🕚 \"]},\"earth\":{\"interval\":180,\"frames\":[\"🌍 \",\"🌎 \",\"🌏 \"]},\"moon\":{\"interval\":80,\"frames\":[\"🌑 \",\"🌒 \",\"🌓 \",\"🌔 \",\"🌕 \",\"🌖 \",\"🌗 \",\"🌘 \"]},\"runner\":{\"interval\":140,\"frames\":[\"🚶 \",\"🏃 \"]},\"pong\":{\"interval\":80,\"frames\":[\"▐⠂ ▌\",\"▐⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂▌\",\"▐ ⠠▌\",\"▐ ⡀▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐⠠ ▌\"]},\"shark\":{\"interval\":120,\"frames\":[\"▐|\\\\____________▌\",\"▐_|\\\\___________▌\",\"▐__|\\\\__________▌\",\"▐___|\\\\_________▌\",\"▐____|\\\\________▌\",\"▐_____|\\\\_______▌\",\"▐______|\\\\______▌\",\"▐_______|\\\\_____▌\",\"▐________|\\\\____▌\",\"▐_________|\\\\___▌\",\"▐__________|\\\\__▌\",\"▐___________|\\\\_▌\",\"▐____________|\\\\▌\",\"▐____________/|▌\",\"▐___________/|_▌\",\"▐__________/|__▌\",\"▐_________/|___▌\",\"▐________/|____▌\",\"▐_______/|_____▌\",\"▐______/|______▌\",\"▐_____/|_______▌\",\"▐____/|________▌\",\"▐___/|_________▌\",\"▐__/|__________▌\",\"▐_/|___________▌\",\"▐/|____________▌\"]},\"dqpb\":{\"interval\":100,\"frames\":[\"d\",\"q\",\"p\",\"b\"]},\"weather\":{\"interval\":100,\"frames\":[\"☀️ \",\"☀️ \",\"☀️ \",\"🌤 \",\"⛅️ \",\"🌥 \",\"☁️ \",\"🌧 \",\"🌨 \",\"🌧 \",\"🌨 \",\"🌧 \",\"🌨 \",\"⛈ \",\"🌨 \",\"🌧 \",\"🌨 \",\"☁️ \",\"🌥 \",\"⛅️ \",\"🌤 \",\"☀️ \",\"☀️ \"]},\"christmas\":{\"interval\":400,\"frames\":[\"🌲\",\"🎄\"]}}"); /***/ }), -/* 384 */ +/* 398 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const chalk = __webpack_require__(385); +const chalk = __webpack_require__(399); const isSupported = process.platform !== 'win32' || process.env.CI || process.env.TERM === 'xterm-256color'; @@ -49173,16 +52088,16 @@ module.exports = isSupported ? main : fallbacks; /***/ }), -/* 385 */ +/* 399 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const escapeStringRegexp = __webpack_require__(113); -const ansiStyles = __webpack_require__(386); -const stdoutColor = __webpack_require__(387).stdout; +const escapeStringRegexp = __webpack_require__(178); +const ansiStyles = __webpack_require__(400); +const stdoutColor = __webpack_require__(184).stdout; -const template = __webpack_require__(388); +const template = __webpack_require__(401); const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); @@ -49408,12 +52323,12 @@ module.exports.default = module.exports; // For TypeScript /***/ }), -/* 386 */ +/* 400 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(module) { -const colorConvert = __webpack_require__(116); +const colorConvert = __webpack_require__(180); const wrapAnsi16 = (fn, offset) => function () { const code = fn.apply(colorConvert, arguments); @@ -49578,152 +52493,10 @@ Object.defineProperty(module, 'exports', { get: assembleStyles }); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(115)(module))) +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(114)(module))) /***/ }), -/* 387 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -const os = __webpack_require__(121); -const hasFlag = __webpack_require__(122); - -const env = process.env; - -let forceColor; -if (hasFlag('no-color') || - hasFlag('no-colors') || - hasFlag('color=false')) { - forceColor = false; -} else if (hasFlag('color') || - hasFlag('colors') || - hasFlag('color=true') || - hasFlag('color=always')) { - forceColor = true; -} -if ('FORCE_COLOR' in env) { - forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0; -} - -function translateLevel(level) { - if (level === 0) { - return false; - } - - return { - level, - hasBasic: true, - has256: level >= 2, - has16m: level >= 3 - }; -} - -function supportsColor(stream) { - if (forceColor === false) { - return 0; - } - - if (hasFlag('color=16m') || - hasFlag('color=full') || - hasFlag('color=truecolor')) { - return 3; - } - - if (hasFlag('color=256')) { - return 2; - } - - if (stream && !stream.isTTY && forceColor !== true) { - // VS code debugger doesn't have isTTY set - if (env.VSCODE_PID) { - return 1; - } - return 0; - } - - const min = forceColor ? 1 : 0; - - if (process.platform === 'win32') { - // Node.js 7.5.0 is the first version of Node.js to include a patch to - // libuv that enables 256 color output on Windows. Anything earlier and it - // won't work. However, here we target Node.js 8 at minimum as it is an LTS - // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows - // release that supports 256 colors. Windows 10 build 14931 is the first release - // that supports 16m/TrueColor. - const osRelease = os.release().split('.'); - if ( - Number(process.versions.node.split('.')[0]) >= 8 && - Number(osRelease[0]) >= 10 && - Number(osRelease[2]) >= 10586 - ) { - return Number(osRelease[2]) >= 14931 ? 3 : 2; - } - - return 1; - } - - if ('CI' in env) { - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { - return 1; - } - - return min; - } - - if ('TEAMCITY_VERSION' in env) { - return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; - } - - if (env.COLORTERM === 'truecolor') { - return 3; - } - - if ('TERM_PROGRAM' in env) { - const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); - - switch (env.TERM_PROGRAM) { - case 'iTerm.app': - return version >= 3 ? 3 : 2; - case 'Apple_Terminal': - return 2; - // No default - } - } - - if (/-256(color)?$/i.test(env.TERM)) { - return 2; - } - - if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { - return 1; - } - - if ('COLORTERM' in env) { - return 1; - } - - if (env.TERM === 'dumb') { - return min; - } - - return min; -} - -function getSupportLevel(stream) { - const level = supportsColor(stream); - return translateLevel(level); -} - -module.exports = { - supportsColor: getSupportLevel, - stdout: getSupportLevel(process.stdout), - stderr: getSupportLevel(process.stderr) -}; - - -/***/ }), -/* 388 */ +/* 401 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -49858,16 +52631,16 @@ module.exports = (chalk, tmp) => { /***/ }), -/* 389 */ +/* 402 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RunCommand", function() { return RunCommand; }); -/* harmony import */ var _utils_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(161); -/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(142); -/* harmony import */ var _utils_parallelize__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(143); -/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(144); +/* harmony import */ var _utils_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(162); +/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(143); +/* harmony import */ var _utils_parallelize__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(144); +/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(145); /* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with @@ -49919,17 +52692,17 @@ const RunCommand = { }; /***/ }), -/* 390 */ +/* 403 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WatchCommand", function() { return WatchCommand; }); -/* harmony import */ var _utils_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(161); -/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(142); -/* harmony import */ var _utils_parallelize__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(143); -/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(144); -/* harmony import */ var _utils_watch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(391); +/* harmony import */ var _utils_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(162); +/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(143); +/* harmony import */ var _utils_parallelize__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(144); +/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(145); +/* harmony import */ var _utils_watch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(404); /* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with @@ -50014,14 +52787,14 @@ const WatchCommand = { }; /***/ }), -/* 391 */ +/* 404 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "waitUntilWatchIsReady", function() { return waitUntilWatchIsReady; }); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8); -/* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(392); +/* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(405); /* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with @@ -50088,141 +52861,141 @@ function waitUntilWatchIsReady(stream, opts = {}) { } /***/ }), -/* 392 */ +/* 405 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); -/* harmony import */ var _internal_operators_audit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(393); +/* harmony import */ var _internal_operators_audit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(406); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "audit", function() { return _internal_operators_audit__WEBPACK_IMPORTED_MODULE_0__["audit"]; }); -/* harmony import */ var _internal_operators_auditTime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(394); +/* harmony import */ var _internal_operators_auditTime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(407); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "auditTime", function() { return _internal_operators_auditTime__WEBPACK_IMPORTED_MODULE_1__["auditTime"]; }); -/* harmony import */ var _internal_operators_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(395); +/* harmony import */ var _internal_operators_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(408); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buffer", function() { return _internal_operators_buffer__WEBPACK_IMPORTED_MODULE_2__["buffer"]; }); -/* harmony import */ var _internal_operators_bufferCount__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(396); +/* harmony import */ var _internal_operators_bufferCount__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(409); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferCount", function() { return _internal_operators_bufferCount__WEBPACK_IMPORTED_MODULE_3__["bufferCount"]; }); -/* harmony import */ var _internal_operators_bufferTime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(397); +/* harmony import */ var _internal_operators_bufferTime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(410); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferTime", function() { return _internal_operators_bufferTime__WEBPACK_IMPORTED_MODULE_4__["bufferTime"]; }); -/* harmony import */ var _internal_operators_bufferToggle__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(398); +/* harmony import */ var _internal_operators_bufferToggle__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(411); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferToggle", function() { return _internal_operators_bufferToggle__WEBPACK_IMPORTED_MODULE_5__["bufferToggle"]; }); -/* harmony import */ var _internal_operators_bufferWhen__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(399); +/* harmony import */ var _internal_operators_bufferWhen__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(412); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferWhen", function() { return _internal_operators_bufferWhen__WEBPACK_IMPORTED_MODULE_6__["bufferWhen"]; }); -/* harmony import */ var _internal_operators_catchError__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(400); +/* harmony import */ var _internal_operators_catchError__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(413); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "catchError", function() { return _internal_operators_catchError__WEBPACK_IMPORTED_MODULE_7__["catchError"]; }); -/* harmony import */ var _internal_operators_combineAll__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(401); +/* harmony import */ var _internal_operators_combineAll__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(414); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "combineAll", function() { return _internal_operators_combineAll__WEBPACK_IMPORTED_MODULE_8__["combineAll"]; }); -/* harmony import */ var _internal_operators_combineLatest__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(402); +/* harmony import */ var _internal_operators_combineLatest__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(415); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "combineLatest", function() { return _internal_operators_combineLatest__WEBPACK_IMPORTED_MODULE_9__["combineLatest"]; }); -/* harmony import */ var _internal_operators_concat__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(403); +/* harmony import */ var _internal_operators_concat__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(416); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concat", function() { return _internal_operators_concat__WEBPACK_IMPORTED_MODULE_10__["concat"]; }); /* harmony import */ var _internal_operators_concatAll__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(80); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatAll", function() { return _internal_operators_concatAll__WEBPACK_IMPORTED_MODULE_11__["concatAll"]; }); -/* harmony import */ var _internal_operators_concatMap__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(404); +/* harmony import */ var _internal_operators_concatMap__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(417); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatMap", function() { return _internal_operators_concatMap__WEBPACK_IMPORTED_MODULE_12__["concatMap"]; }); -/* harmony import */ var _internal_operators_concatMapTo__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(405); +/* harmony import */ var _internal_operators_concatMapTo__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(418); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatMapTo", function() { return _internal_operators_concatMapTo__WEBPACK_IMPORTED_MODULE_13__["concatMapTo"]; }); -/* harmony import */ var _internal_operators_count__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(406); +/* harmony import */ var _internal_operators_count__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(419); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "count", function() { return _internal_operators_count__WEBPACK_IMPORTED_MODULE_14__["count"]; }); -/* harmony import */ var _internal_operators_debounce__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(407); +/* harmony import */ var _internal_operators_debounce__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(420); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return _internal_operators_debounce__WEBPACK_IMPORTED_MODULE_15__["debounce"]; }); -/* harmony import */ var _internal_operators_debounceTime__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(408); +/* harmony import */ var _internal_operators_debounceTime__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(421); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "debounceTime", function() { return _internal_operators_debounceTime__WEBPACK_IMPORTED_MODULE_16__["debounceTime"]; }); -/* harmony import */ var _internal_operators_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(409); +/* harmony import */ var _internal_operators_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(422); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defaultIfEmpty", function() { return _internal_operators_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_17__["defaultIfEmpty"]; }); -/* harmony import */ var _internal_operators_delay__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(410); +/* harmony import */ var _internal_operators_delay__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(423); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return _internal_operators_delay__WEBPACK_IMPORTED_MODULE_18__["delay"]; }); -/* harmony import */ var _internal_operators_delayWhen__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(412); +/* harmony import */ var _internal_operators_delayWhen__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(425); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "delayWhen", function() { return _internal_operators_delayWhen__WEBPACK_IMPORTED_MODULE_19__["delayWhen"]; }); -/* harmony import */ var _internal_operators_dematerialize__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(413); +/* harmony import */ var _internal_operators_dematerialize__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(426); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "dematerialize", function() { return _internal_operators_dematerialize__WEBPACK_IMPORTED_MODULE_20__["dematerialize"]; }); -/* harmony import */ var _internal_operators_distinct__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(414); +/* harmony import */ var _internal_operators_distinct__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(427); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "distinct", function() { return _internal_operators_distinct__WEBPACK_IMPORTED_MODULE_21__["distinct"]; }); -/* harmony import */ var _internal_operators_distinctUntilChanged__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(415); +/* harmony import */ var _internal_operators_distinctUntilChanged__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(428); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "distinctUntilChanged", function() { return _internal_operators_distinctUntilChanged__WEBPACK_IMPORTED_MODULE_22__["distinctUntilChanged"]; }); -/* harmony import */ var _internal_operators_distinctUntilKeyChanged__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(416); +/* harmony import */ var _internal_operators_distinctUntilKeyChanged__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(429); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "distinctUntilKeyChanged", function() { return _internal_operators_distinctUntilKeyChanged__WEBPACK_IMPORTED_MODULE_23__["distinctUntilKeyChanged"]; }); -/* harmony import */ var _internal_operators_elementAt__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(417); +/* harmony import */ var _internal_operators_elementAt__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(430); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "elementAt", function() { return _internal_operators_elementAt__WEBPACK_IMPORTED_MODULE_24__["elementAt"]; }); -/* harmony import */ var _internal_operators_endWith__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(420); +/* harmony import */ var _internal_operators_endWith__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(433); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "endWith", function() { return _internal_operators_endWith__WEBPACK_IMPORTED_MODULE_25__["endWith"]; }); -/* harmony import */ var _internal_operators_every__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(421); +/* harmony import */ var _internal_operators_every__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(434); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "every", function() { return _internal_operators_every__WEBPACK_IMPORTED_MODULE_26__["every"]; }); -/* harmony import */ var _internal_operators_exhaust__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(422); +/* harmony import */ var _internal_operators_exhaust__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(435); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "exhaust", function() { return _internal_operators_exhaust__WEBPACK_IMPORTED_MODULE_27__["exhaust"]; }); -/* harmony import */ var _internal_operators_exhaustMap__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(423); +/* harmony import */ var _internal_operators_exhaustMap__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(436); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "exhaustMap", function() { return _internal_operators_exhaustMap__WEBPACK_IMPORTED_MODULE_28__["exhaustMap"]; }); -/* harmony import */ var _internal_operators_expand__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(424); +/* harmony import */ var _internal_operators_expand__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(437); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "expand", function() { return _internal_operators_expand__WEBPACK_IMPORTED_MODULE_29__["expand"]; }); /* harmony import */ var _internal_operators_filter__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(104); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return _internal_operators_filter__WEBPACK_IMPORTED_MODULE_30__["filter"]; }); -/* harmony import */ var _internal_operators_finalize__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(425); +/* harmony import */ var _internal_operators_finalize__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(438); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "finalize", function() { return _internal_operators_finalize__WEBPACK_IMPORTED_MODULE_31__["finalize"]; }); -/* harmony import */ var _internal_operators_find__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(426); +/* harmony import */ var _internal_operators_find__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(439); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "find", function() { return _internal_operators_find__WEBPACK_IMPORTED_MODULE_32__["find"]; }); -/* harmony import */ var _internal_operators_findIndex__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(427); +/* harmony import */ var _internal_operators_findIndex__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(440); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return _internal_operators_findIndex__WEBPACK_IMPORTED_MODULE_33__["findIndex"]; }); -/* harmony import */ var _internal_operators_first__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(428); +/* harmony import */ var _internal_operators_first__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(441); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "first", function() { return _internal_operators_first__WEBPACK_IMPORTED_MODULE_34__["first"]; }); /* harmony import */ var _internal_operators_groupBy__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(31); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return _internal_operators_groupBy__WEBPACK_IMPORTED_MODULE_35__["groupBy"]; }); -/* harmony import */ var _internal_operators_ignoreElements__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(429); +/* harmony import */ var _internal_operators_ignoreElements__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(442); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ignoreElements", function() { return _internal_operators_ignoreElements__WEBPACK_IMPORTED_MODULE_36__["ignoreElements"]; }); -/* harmony import */ var _internal_operators_isEmpty__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(430); +/* harmony import */ var _internal_operators_isEmpty__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(443); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return _internal_operators_isEmpty__WEBPACK_IMPORTED_MODULE_37__["isEmpty"]; }); -/* harmony import */ var _internal_operators_last__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(431); +/* harmony import */ var _internal_operators_last__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(444); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "last", function() { return _internal_operators_last__WEBPACK_IMPORTED_MODULE_38__["last"]; }); /* harmony import */ var _internal_operators_map__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(66); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "map", function() { return _internal_operators_map__WEBPACK_IMPORTED_MODULE_39__["map"]; }); -/* harmony import */ var _internal_operators_mapTo__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(433); +/* harmony import */ var _internal_operators_mapTo__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(446); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mapTo", function() { return _internal_operators_mapTo__WEBPACK_IMPORTED_MODULE_40__["mapTo"]; }); -/* harmony import */ var _internal_operators_materialize__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(434); +/* harmony import */ var _internal_operators_materialize__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(447); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "materialize", function() { return _internal_operators_materialize__WEBPACK_IMPORTED_MODULE_41__["materialize"]; }); -/* harmony import */ var _internal_operators_max__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(435); +/* harmony import */ var _internal_operators_max__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(448); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "max", function() { return _internal_operators_max__WEBPACK_IMPORTED_MODULE_42__["max"]; }); -/* harmony import */ var _internal_operators_merge__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(438); +/* harmony import */ var _internal_operators_merge__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(451); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "merge", function() { return _internal_operators_merge__WEBPACK_IMPORTED_MODULE_43__["merge"]; }); /* harmony import */ var _internal_operators_mergeAll__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(81); @@ -50233,175 +53006,175 @@ __webpack_require__.r(__webpack_exports__); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "flatMap", function() { return _internal_operators_mergeMap__WEBPACK_IMPORTED_MODULE_45__["mergeMap"]; }); -/* harmony import */ var _internal_operators_mergeMapTo__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(439); +/* harmony import */ var _internal_operators_mergeMapTo__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(452); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeMapTo", function() { return _internal_operators_mergeMapTo__WEBPACK_IMPORTED_MODULE_46__["mergeMapTo"]; }); -/* harmony import */ var _internal_operators_mergeScan__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(440); +/* harmony import */ var _internal_operators_mergeScan__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(453); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeScan", function() { return _internal_operators_mergeScan__WEBPACK_IMPORTED_MODULE_47__["mergeScan"]; }); -/* harmony import */ var _internal_operators_min__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(441); +/* harmony import */ var _internal_operators_min__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(454); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "min", function() { return _internal_operators_min__WEBPACK_IMPORTED_MODULE_48__["min"]; }); -/* harmony import */ var _internal_operators_multicast__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(442); +/* harmony import */ var _internal_operators_multicast__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(455); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "multicast", function() { return _internal_operators_multicast__WEBPACK_IMPORTED_MODULE_49__["multicast"]; }); /* harmony import */ var _internal_operators_observeOn__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(41); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "observeOn", function() { return _internal_operators_observeOn__WEBPACK_IMPORTED_MODULE_50__["observeOn"]; }); -/* harmony import */ var _internal_operators_onErrorResumeNext__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(443); +/* harmony import */ var _internal_operators_onErrorResumeNext__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(456); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "onErrorResumeNext", function() { return _internal_operators_onErrorResumeNext__WEBPACK_IMPORTED_MODULE_51__["onErrorResumeNext"]; }); -/* harmony import */ var _internal_operators_pairwise__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(444); +/* harmony import */ var _internal_operators_pairwise__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(457); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pairwise", function() { return _internal_operators_pairwise__WEBPACK_IMPORTED_MODULE_52__["pairwise"]; }); -/* harmony import */ var _internal_operators_partition__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(445); +/* harmony import */ var _internal_operators_partition__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(458); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return _internal_operators_partition__WEBPACK_IMPORTED_MODULE_53__["partition"]; }); -/* harmony import */ var _internal_operators_pluck__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(446); +/* harmony import */ var _internal_operators_pluck__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(459); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return _internal_operators_pluck__WEBPACK_IMPORTED_MODULE_54__["pluck"]; }); -/* harmony import */ var _internal_operators_publish__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(447); +/* harmony import */ var _internal_operators_publish__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(460); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publish", function() { return _internal_operators_publish__WEBPACK_IMPORTED_MODULE_55__["publish"]; }); -/* harmony import */ var _internal_operators_publishBehavior__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(448); +/* harmony import */ var _internal_operators_publishBehavior__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(461); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publishBehavior", function() { return _internal_operators_publishBehavior__WEBPACK_IMPORTED_MODULE_56__["publishBehavior"]; }); -/* harmony import */ var _internal_operators_publishLast__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(449); +/* harmony import */ var _internal_operators_publishLast__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(462); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publishLast", function() { return _internal_operators_publishLast__WEBPACK_IMPORTED_MODULE_57__["publishLast"]; }); -/* harmony import */ var _internal_operators_publishReplay__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(450); +/* harmony import */ var _internal_operators_publishReplay__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(463); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publishReplay", function() { return _internal_operators_publishReplay__WEBPACK_IMPORTED_MODULE_58__["publishReplay"]; }); -/* harmony import */ var _internal_operators_race__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(451); +/* harmony import */ var _internal_operators_race__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(464); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "race", function() { return _internal_operators_race__WEBPACK_IMPORTED_MODULE_59__["race"]; }); -/* harmony import */ var _internal_operators_reduce__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(436); +/* harmony import */ var _internal_operators_reduce__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(449); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return _internal_operators_reduce__WEBPACK_IMPORTED_MODULE_60__["reduce"]; }); -/* harmony import */ var _internal_operators_repeat__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(452); +/* harmony import */ var _internal_operators_repeat__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(465); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "repeat", function() { return _internal_operators_repeat__WEBPACK_IMPORTED_MODULE_61__["repeat"]; }); -/* harmony import */ var _internal_operators_repeatWhen__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(453); +/* harmony import */ var _internal_operators_repeatWhen__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(466); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "repeatWhen", function() { return _internal_operators_repeatWhen__WEBPACK_IMPORTED_MODULE_62__["repeatWhen"]; }); -/* harmony import */ var _internal_operators_retry__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(454); +/* harmony import */ var _internal_operators_retry__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(467); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "retry", function() { return _internal_operators_retry__WEBPACK_IMPORTED_MODULE_63__["retry"]; }); -/* harmony import */ var _internal_operators_retryWhen__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(455); +/* harmony import */ var _internal_operators_retryWhen__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(468); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "retryWhen", function() { return _internal_operators_retryWhen__WEBPACK_IMPORTED_MODULE_64__["retryWhen"]; }); /* harmony import */ var _internal_operators_refCount__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__(30); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "refCount", function() { return _internal_operators_refCount__WEBPACK_IMPORTED_MODULE_65__["refCount"]; }); -/* harmony import */ var _internal_operators_sample__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(456); +/* harmony import */ var _internal_operators_sample__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(469); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return _internal_operators_sample__WEBPACK_IMPORTED_MODULE_66__["sample"]; }); -/* harmony import */ var _internal_operators_sampleTime__WEBPACK_IMPORTED_MODULE_67__ = __webpack_require__(457); +/* harmony import */ var _internal_operators_sampleTime__WEBPACK_IMPORTED_MODULE_67__ = __webpack_require__(470); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sampleTime", function() { return _internal_operators_sampleTime__WEBPACK_IMPORTED_MODULE_67__["sampleTime"]; }); -/* harmony import */ var _internal_operators_scan__WEBPACK_IMPORTED_MODULE_68__ = __webpack_require__(437); +/* harmony import */ var _internal_operators_scan__WEBPACK_IMPORTED_MODULE_68__ = __webpack_require__(450); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "scan", function() { return _internal_operators_scan__WEBPACK_IMPORTED_MODULE_68__["scan"]; }); -/* harmony import */ var _internal_operators_sequenceEqual__WEBPACK_IMPORTED_MODULE_69__ = __webpack_require__(458); +/* harmony import */ var _internal_operators_sequenceEqual__WEBPACK_IMPORTED_MODULE_69__ = __webpack_require__(471); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sequenceEqual", function() { return _internal_operators_sequenceEqual__WEBPACK_IMPORTED_MODULE_69__["sequenceEqual"]; }); -/* harmony import */ var _internal_operators_share__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__(459); +/* harmony import */ var _internal_operators_share__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__(472); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "share", function() { return _internal_operators_share__WEBPACK_IMPORTED_MODULE_70__["share"]; }); -/* harmony import */ var _internal_operators_shareReplay__WEBPACK_IMPORTED_MODULE_71__ = __webpack_require__(460); +/* harmony import */ var _internal_operators_shareReplay__WEBPACK_IMPORTED_MODULE_71__ = __webpack_require__(473); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "shareReplay", function() { return _internal_operators_shareReplay__WEBPACK_IMPORTED_MODULE_71__["shareReplay"]; }); -/* harmony import */ var _internal_operators_single__WEBPACK_IMPORTED_MODULE_72__ = __webpack_require__(461); +/* harmony import */ var _internal_operators_single__WEBPACK_IMPORTED_MODULE_72__ = __webpack_require__(474); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "single", function() { return _internal_operators_single__WEBPACK_IMPORTED_MODULE_72__["single"]; }); -/* harmony import */ var _internal_operators_skip__WEBPACK_IMPORTED_MODULE_73__ = __webpack_require__(462); +/* harmony import */ var _internal_operators_skip__WEBPACK_IMPORTED_MODULE_73__ = __webpack_require__(475); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skip", function() { return _internal_operators_skip__WEBPACK_IMPORTED_MODULE_73__["skip"]; }); -/* harmony import */ var _internal_operators_skipLast__WEBPACK_IMPORTED_MODULE_74__ = __webpack_require__(463); +/* harmony import */ var _internal_operators_skipLast__WEBPACK_IMPORTED_MODULE_74__ = __webpack_require__(476); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skipLast", function() { return _internal_operators_skipLast__WEBPACK_IMPORTED_MODULE_74__["skipLast"]; }); -/* harmony import */ var _internal_operators_skipUntil__WEBPACK_IMPORTED_MODULE_75__ = __webpack_require__(464); +/* harmony import */ var _internal_operators_skipUntil__WEBPACK_IMPORTED_MODULE_75__ = __webpack_require__(477); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skipUntil", function() { return _internal_operators_skipUntil__WEBPACK_IMPORTED_MODULE_75__["skipUntil"]; }); -/* harmony import */ var _internal_operators_skipWhile__WEBPACK_IMPORTED_MODULE_76__ = __webpack_require__(465); +/* harmony import */ var _internal_operators_skipWhile__WEBPACK_IMPORTED_MODULE_76__ = __webpack_require__(478); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skipWhile", function() { return _internal_operators_skipWhile__WEBPACK_IMPORTED_MODULE_76__["skipWhile"]; }); -/* harmony import */ var _internal_operators_startWith__WEBPACK_IMPORTED_MODULE_77__ = __webpack_require__(466); +/* harmony import */ var _internal_operators_startWith__WEBPACK_IMPORTED_MODULE_77__ = __webpack_require__(479); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "startWith", function() { return _internal_operators_startWith__WEBPACK_IMPORTED_MODULE_77__["startWith"]; }); -/* harmony import */ var _internal_operators_subscribeOn__WEBPACK_IMPORTED_MODULE_78__ = __webpack_require__(467); +/* harmony import */ var _internal_operators_subscribeOn__WEBPACK_IMPORTED_MODULE_78__ = __webpack_require__(480); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "subscribeOn", function() { return _internal_operators_subscribeOn__WEBPACK_IMPORTED_MODULE_78__["subscribeOn"]; }); -/* harmony import */ var _internal_operators_switchAll__WEBPACK_IMPORTED_MODULE_79__ = __webpack_require__(469); +/* harmony import */ var _internal_operators_switchAll__WEBPACK_IMPORTED_MODULE_79__ = __webpack_require__(482); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "switchAll", function() { return _internal_operators_switchAll__WEBPACK_IMPORTED_MODULE_79__["switchAll"]; }); -/* harmony import */ var _internal_operators_switchMap__WEBPACK_IMPORTED_MODULE_80__ = __webpack_require__(470); +/* harmony import */ var _internal_operators_switchMap__WEBPACK_IMPORTED_MODULE_80__ = __webpack_require__(483); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "switchMap", function() { return _internal_operators_switchMap__WEBPACK_IMPORTED_MODULE_80__["switchMap"]; }); -/* harmony import */ var _internal_operators_switchMapTo__WEBPACK_IMPORTED_MODULE_81__ = __webpack_require__(471); +/* harmony import */ var _internal_operators_switchMapTo__WEBPACK_IMPORTED_MODULE_81__ = __webpack_require__(484); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "switchMapTo", function() { return _internal_operators_switchMapTo__WEBPACK_IMPORTED_MODULE_81__["switchMapTo"]; }); -/* harmony import */ var _internal_operators_take__WEBPACK_IMPORTED_MODULE_82__ = __webpack_require__(419); +/* harmony import */ var _internal_operators_take__WEBPACK_IMPORTED_MODULE_82__ = __webpack_require__(432); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "take", function() { return _internal_operators_take__WEBPACK_IMPORTED_MODULE_82__["take"]; }); -/* harmony import */ var _internal_operators_takeLast__WEBPACK_IMPORTED_MODULE_83__ = __webpack_require__(432); +/* harmony import */ var _internal_operators_takeLast__WEBPACK_IMPORTED_MODULE_83__ = __webpack_require__(445); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "takeLast", function() { return _internal_operators_takeLast__WEBPACK_IMPORTED_MODULE_83__["takeLast"]; }); -/* harmony import */ var _internal_operators_takeUntil__WEBPACK_IMPORTED_MODULE_84__ = __webpack_require__(472); +/* harmony import */ var _internal_operators_takeUntil__WEBPACK_IMPORTED_MODULE_84__ = __webpack_require__(485); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "takeUntil", function() { return _internal_operators_takeUntil__WEBPACK_IMPORTED_MODULE_84__["takeUntil"]; }); -/* harmony import */ var _internal_operators_takeWhile__WEBPACK_IMPORTED_MODULE_85__ = __webpack_require__(473); +/* harmony import */ var _internal_operators_takeWhile__WEBPACK_IMPORTED_MODULE_85__ = __webpack_require__(486); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "takeWhile", function() { return _internal_operators_takeWhile__WEBPACK_IMPORTED_MODULE_85__["takeWhile"]; }); -/* harmony import */ var _internal_operators_tap__WEBPACK_IMPORTED_MODULE_86__ = __webpack_require__(474); +/* harmony import */ var _internal_operators_tap__WEBPACK_IMPORTED_MODULE_86__ = __webpack_require__(487); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return _internal_operators_tap__WEBPACK_IMPORTED_MODULE_86__["tap"]; }); -/* harmony import */ var _internal_operators_throttle__WEBPACK_IMPORTED_MODULE_87__ = __webpack_require__(475); +/* harmony import */ var _internal_operators_throttle__WEBPACK_IMPORTED_MODULE_87__ = __webpack_require__(488); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return _internal_operators_throttle__WEBPACK_IMPORTED_MODULE_87__["throttle"]; }); -/* harmony import */ var _internal_operators_throttleTime__WEBPACK_IMPORTED_MODULE_88__ = __webpack_require__(476); +/* harmony import */ var _internal_operators_throttleTime__WEBPACK_IMPORTED_MODULE_88__ = __webpack_require__(489); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throttleTime", function() { return _internal_operators_throttleTime__WEBPACK_IMPORTED_MODULE_88__["throttleTime"]; }); -/* harmony import */ var _internal_operators_throwIfEmpty__WEBPACK_IMPORTED_MODULE_89__ = __webpack_require__(418); +/* harmony import */ var _internal_operators_throwIfEmpty__WEBPACK_IMPORTED_MODULE_89__ = __webpack_require__(431); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throwIfEmpty", function() { return _internal_operators_throwIfEmpty__WEBPACK_IMPORTED_MODULE_89__["throwIfEmpty"]; }); -/* harmony import */ var _internal_operators_timeInterval__WEBPACK_IMPORTED_MODULE_90__ = __webpack_require__(477); +/* harmony import */ var _internal_operators_timeInterval__WEBPACK_IMPORTED_MODULE_90__ = __webpack_require__(490); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timeInterval", function() { return _internal_operators_timeInterval__WEBPACK_IMPORTED_MODULE_90__["timeInterval"]; }); -/* harmony import */ var _internal_operators_timeout__WEBPACK_IMPORTED_MODULE_91__ = __webpack_require__(478); +/* harmony import */ var _internal_operators_timeout__WEBPACK_IMPORTED_MODULE_91__ = __webpack_require__(491); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timeout", function() { return _internal_operators_timeout__WEBPACK_IMPORTED_MODULE_91__["timeout"]; }); -/* harmony import */ var _internal_operators_timeoutWith__WEBPACK_IMPORTED_MODULE_92__ = __webpack_require__(479); +/* harmony import */ var _internal_operators_timeoutWith__WEBPACK_IMPORTED_MODULE_92__ = __webpack_require__(492); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timeoutWith", function() { return _internal_operators_timeoutWith__WEBPACK_IMPORTED_MODULE_92__["timeoutWith"]; }); -/* harmony import */ var _internal_operators_timestamp__WEBPACK_IMPORTED_MODULE_93__ = __webpack_require__(480); +/* harmony import */ var _internal_operators_timestamp__WEBPACK_IMPORTED_MODULE_93__ = __webpack_require__(493); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timestamp", function() { return _internal_operators_timestamp__WEBPACK_IMPORTED_MODULE_93__["timestamp"]; }); -/* harmony import */ var _internal_operators_toArray__WEBPACK_IMPORTED_MODULE_94__ = __webpack_require__(481); +/* harmony import */ var _internal_operators_toArray__WEBPACK_IMPORTED_MODULE_94__ = __webpack_require__(494); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return _internal_operators_toArray__WEBPACK_IMPORTED_MODULE_94__["toArray"]; }); -/* harmony import */ var _internal_operators_window__WEBPACK_IMPORTED_MODULE_95__ = __webpack_require__(482); +/* harmony import */ var _internal_operators_window__WEBPACK_IMPORTED_MODULE_95__ = __webpack_require__(495); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "window", function() { return _internal_operators_window__WEBPACK_IMPORTED_MODULE_95__["window"]; }); -/* harmony import */ var _internal_operators_windowCount__WEBPACK_IMPORTED_MODULE_96__ = __webpack_require__(483); +/* harmony import */ var _internal_operators_windowCount__WEBPACK_IMPORTED_MODULE_96__ = __webpack_require__(496); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowCount", function() { return _internal_operators_windowCount__WEBPACK_IMPORTED_MODULE_96__["windowCount"]; }); -/* harmony import */ var _internal_operators_windowTime__WEBPACK_IMPORTED_MODULE_97__ = __webpack_require__(484); +/* harmony import */ var _internal_operators_windowTime__WEBPACK_IMPORTED_MODULE_97__ = __webpack_require__(497); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowTime", function() { return _internal_operators_windowTime__WEBPACK_IMPORTED_MODULE_97__["windowTime"]; }); -/* harmony import */ var _internal_operators_windowToggle__WEBPACK_IMPORTED_MODULE_98__ = __webpack_require__(485); +/* harmony import */ var _internal_operators_windowToggle__WEBPACK_IMPORTED_MODULE_98__ = __webpack_require__(498); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowToggle", function() { return _internal_operators_windowToggle__WEBPACK_IMPORTED_MODULE_98__["windowToggle"]; }); -/* harmony import */ var _internal_operators_windowWhen__WEBPACK_IMPORTED_MODULE_99__ = __webpack_require__(486); +/* harmony import */ var _internal_operators_windowWhen__WEBPACK_IMPORTED_MODULE_99__ = __webpack_require__(499); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowWhen", function() { return _internal_operators_windowWhen__WEBPACK_IMPORTED_MODULE_99__["windowWhen"]; }); -/* harmony import */ var _internal_operators_withLatestFrom__WEBPACK_IMPORTED_MODULE_100__ = __webpack_require__(487); +/* harmony import */ var _internal_operators_withLatestFrom__WEBPACK_IMPORTED_MODULE_100__ = __webpack_require__(500); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "withLatestFrom", function() { return _internal_operators_withLatestFrom__WEBPACK_IMPORTED_MODULE_100__["withLatestFrom"]; }); -/* harmony import */ var _internal_operators_zip__WEBPACK_IMPORTED_MODULE_101__ = __webpack_require__(488); +/* harmony import */ var _internal_operators_zip__WEBPACK_IMPORTED_MODULE_101__ = __webpack_require__(501); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return _internal_operators_zip__WEBPACK_IMPORTED_MODULE_101__["zip"]; }); -/* harmony import */ var _internal_operators_zipAll__WEBPACK_IMPORTED_MODULE_102__ = __webpack_require__(489); +/* harmony import */ var _internal_operators_zipAll__WEBPACK_IMPORTED_MODULE_102__ = __webpack_require__(502); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "zipAll", function() { return _internal_operators_zipAll__WEBPACK_IMPORTED_MODULE_102__["zipAll"]; }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ @@ -50513,7 +53286,7 @@ __webpack_require__.r(__webpack_exports__); /***/ }), -/* 393 */ +/* 406 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -50594,14 +53367,14 @@ var AuditSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 394 */ +/* 407 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "auditTime", function() { return auditTime; }); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55); -/* harmony import */ var _audit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(393); +/* harmony import */ var _audit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(406); /* harmony import */ var _observable_timer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(107); /** PURE_IMPORTS_START _scheduler_async,_audit,_observable_timer PURE_IMPORTS_END */ @@ -50617,7 +53390,7 @@ function auditTime(duration, scheduler) { /***/ }), -/* 395 */ +/* 408 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -50666,7 +53439,7 @@ var BufferSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 396 */ +/* 409 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -50767,7 +53540,7 @@ var BufferSkipCountSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 397 */ +/* 410 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -50928,7 +53701,7 @@ function dispatchBufferClose(arg) { /***/ }), -/* 398 */ +/* 411 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -51048,7 +53821,7 @@ var BufferToggleSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 399 */ +/* 412 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -51143,7 +53916,7 @@ var BufferWhenSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 400 */ +/* 413 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -51207,7 +53980,7 @@ var CatchSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 401 */ +/* 414 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -51223,7 +53996,7 @@ function combineAll(project) { /***/ }), -/* 402 */ +/* 415 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -51255,7 +54028,7 @@ function combineLatest() { /***/ }), -/* 403 */ +/* 416 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -51275,7 +54048,7 @@ function concat() { /***/ }), -/* 404 */ +/* 417 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -51291,13 +54064,13 @@ function concatMap(project, resultSelector) { /***/ }), -/* 405 */ +/* 418 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concatMapTo", function() { return concatMapTo; }); -/* harmony import */ var _concatMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(404); +/* harmony import */ var _concatMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(417); /** PURE_IMPORTS_START _concatMap PURE_IMPORTS_END */ function concatMapTo(innerObservable, resultSelector) { @@ -51307,7 +54080,7 @@ function concatMapTo(innerObservable, resultSelector) { /***/ }), -/* 406 */ +/* 419 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -51372,7 +54145,7 @@ var CountSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 407 */ +/* 420 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -51460,7 +54233,7 @@ var DebounceSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 408 */ +/* 421 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -51536,7 +54309,7 @@ function dispatchNext(subscriber) { /***/ }), -/* 409 */ +/* 422 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -51586,7 +54359,7 @@ var DefaultIfEmptySubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 410 */ +/* 423 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -51594,7 +54367,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return delay; }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(55); -/* harmony import */ var _util_isDate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(411); +/* harmony import */ var _util_isDate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(424); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(11); /* harmony import */ var _Notification__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(42); /** PURE_IMPORTS_START tslib,_scheduler_async,_util_isDate,_Subscriber,_Notification PURE_IMPORTS_END */ @@ -51693,7 +54466,7 @@ var DelayMessage = /*@__PURE__*/ (function () { /***/ }), -/* 411 */ +/* 424 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -51707,7 +54480,7 @@ function isDate(value) { /***/ }), -/* 412 */ +/* 425 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -51853,7 +54626,7 @@ var SubscriptionDelaySubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 413 */ +/* 426 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -51891,7 +54664,7 @@ var DeMaterializeSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 414 */ +/* 427 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -51969,7 +54742,7 @@ var DistinctSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 415 */ +/* 428 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -52040,13 +54813,13 @@ var DistinctUntilChangedSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 416 */ +/* 429 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "distinctUntilKeyChanged", function() { return distinctUntilKeyChanged; }); -/* harmony import */ var _distinctUntilChanged__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(415); +/* harmony import */ var _distinctUntilChanged__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(428); /** PURE_IMPORTS_START _distinctUntilChanged PURE_IMPORTS_END */ function distinctUntilKeyChanged(key, compare) { @@ -52056,7 +54829,7 @@ function distinctUntilKeyChanged(key, compare) { /***/ }), -/* 417 */ +/* 430 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -52064,9 +54837,9 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "elementAt", function() { return elementAt; }); /* harmony import */ var _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(62); /* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(104); -/* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(418); -/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(409); -/* harmony import */ var _take__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(419); +/* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(431); +/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(422); +/* harmony import */ var _take__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(432); /** PURE_IMPORTS_START _util_ArgumentOutOfRangeError,_filter,_throwIfEmpty,_defaultIfEmpty,_take PURE_IMPORTS_END */ @@ -52088,7 +54861,7 @@ function elementAt(index, defaultValue) { /***/ }), -/* 418 */ +/* 431 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -52154,7 +54927,7 @@ function defaultErrorFactory() { /***/ }), -/* 419 */ +/* 432 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -52216,7 +54989,7 @@ var TakeSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 420 */ +/* 433 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -52238,7 +55011,7 @@ function endWith() { /***/ }), -/* 421 */ +/* 434 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -52300,7 +55073,7 @@ var EverySubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 422 */ +/* 435 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -52357,7 +55130,7 @@ var SwitchFirstSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 423 */ +/* 436 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -52457,7 +55230,7 @@ var ExhaustMapSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 424 */ +/* 437 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -52576,7 +55349,7 @@ var ExpandSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 425 */ +/* 438 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -52614,7 +55387,7 @@ var FinallySubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 426 */ +/* 439 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -52686,13 +55459,13 @@ var FindValueSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 427 */ +/* 440 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return findIndex; }); -/* harmony import */ var _operators_find__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(426); +/* harmony import */ var _operators_find__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(439); /** PURE_IMPORTS_START _operators_find PURE_IMPORTS_END */ function findIndex(predicate, thisArg) { @@ -52702,7 +55475,7 @@ function findIndex(predicate, thisArg) { /***/ }), -/* 428 */ +/* 441 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -52710,9 +55483,9 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return first; }); /* harmony import */ var _util_EmptyError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(63); /* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(104); -/* harmony import */ var _take__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(419); -/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(409); -/* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(418); +/* harmony import */ var _take__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(432); +/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(422); +/* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(431); /* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(25); /** PURE_IMPORTS_START _util_EmptyError,_filter,_take,_defaultIfEmpty,_throwIfEmpty,_util_identity PURE_IMPORTS_END */ @@ -52729,7 +55502,7 @@ function first(predicate, defaultValue) { /***/ }), -/* 429 */ +/* 442 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -52766,7 +55539,7 @@ var IgnoreElementsSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 430 */ +/* 443 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -52810,7 +55583,7 @@ var IsEmptySubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 431 */ +/* 444 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -52818,9 +55591,9 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return last; }); /* harmony import */ var _util_EmptyError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(63); /* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(104); -/* harmony import */ var _takeLast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(432); -/* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(418); -/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(409); +/* harmony import */ var _takeLast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(445); +/* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(431); +/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(422); /* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(25); /** PURE_IMPORTS_START _util_EmptyError,_filter,_takeLast,_throwIfEmpty,_defaultIfEmpty,_util_identity PURE_IMPORTS_END */ @@ -52837,7 +55610,7 @@ function last(predicate, defaultValue) { /***/ }), -/* 432 */ +/* 445 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -52914,7 +55687,7 @@ var TakeLastSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 433 */ +/* 446 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -52953,7 +55726,7 @@ var MapToSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 434 */ +/* 447 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -53003,13 +55776,13 @@ var MaterializeSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 435 */ +/* 448 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return max; }); -/* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(436); +/* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(449); /** PURE_IMPORTS_START _reduce PURE_IMPORTS_END */ function max(comparer) { @@ -53022,15 +55795,15 @@ function max(comparer) { /***/ }), -/* 436 */ +/* 449 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return reduce; }); -/* harmony import */ var _scan__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(437); -/* harmony import */ var _takeLast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(432); -/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(409); +/* harmony import */ var _scan__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(450); +/* harmony import */ var _takeLast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(445); +/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(422); /* harmony import */ var _util_pipe__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(24); /** PURE_IMPORTS_START _scan,_takeLast,_defaultIfEmpty,_util_pipe PURE_IMPORTS_END */ @@ -53051,7 +55824,7 @@ function reduce(accumulator, seed) { /***/ }), -/* 437 */ +/* 450 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -53133,7 +55906,7 @@ var ScanSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 438 */ +/* 451 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -53153,7 +55926,7 @@ function merge() { /***/ }), -/* 439 */ +/* 452 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -53178,7 +55951,7 @@ function mergeMapTo(innerObservable, resultSelector, concurrent) { /***/ }), -/* 440 */ +/* 453 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -53293,13 +56066,13 @@ var MergeScanSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 441 */ +/* 454 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return min; }); -/* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(436); +/* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(449); /** PURE_IMPORTS_START _reduce PURE_IMPORTS_END */ function min(comparer) { @@ -53312,7 +56085,7 @@ function min(comparer) { /***/ }), -/* 442 */ +/* 455 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -53361,7 +56134,7 @@ var MulticastOperator = /*@__PURE__*/ (function () { /***/ }), -/* 443 */ +/* 456 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -53455,7 +56228,7 @@ var OnErrorResumeNextSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 444 */ +/* 457 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -53503,7 +56276,7 @@ var PairwiseSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 445 */ +/* 458 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -53526,7 +56299,7 @@ function partition(predicate, thisArg) { /***/ }), -/* 446 */ +/* 459 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -53566,14 +56339,14 @@ function plucker(props, length) { /***/ }), -/* 447 */ +/* 460 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publish", function() { return publish; }); /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27); -/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(442); +/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(455); /** PURE_IMPORTS_START _Subject,_multicast PURE_IMPORTS_END */ @@ -53586,14 +56359,14 @@ function publish(selector) { /***/ }), -/* 448 */ +/* 461 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publishBehavior", function() { return publishBehavior; }); /* harmony import */ var _BehaviorSubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32); -/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(442); +/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(455); /** PURE_IMPORTS_START _BehaviorSubject,_multicast PURE_IMPORTS_END */ @@ -53604,14 +56377,14 @@ function publishBehavior(value) { /***/ }), -/* 449 */ +/* 462 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publishLast", function() { return publishLast; }); /* harmony import */ var _AsyncSubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(50); -/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(442); +/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(455); /** PURE_IMPORTS_START _AsyncSubject,_multicast PURE_IMPORTS_END */ @@ -53622,14 +56395,14 @@ function publishLast() { /***/ }), -/* 450 */ +/* 463 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publishReplay", function() { return publishReplay; }); /* harmony import */ var _ReplaySubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33); -/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(442); +/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(455); /** PURE_IMPORTS_START _ReplaySubject,_multicast PURE_IMPORTS_END */ @@ -53645,7 +56418,7 @@ function publishReplay(bufferSize, windowTime, selectorOrScheduler, scheduler) { /***/ }), -/* 451 */ +/* 464 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -53672,7 +56445,7 @@ function race() { /***/ }), -/* 452 */ +/* 465 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -53737,7 +56510,7 @@ var RepeatSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 453 */ +/* 466 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -53833,7 +56606,7 @@ var RepeatWhenSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 454 */ +/* 467 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -53886,7 +56659,7 @@ var RetrySubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 455 */ +/* 468 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -53974,7 +56747,7 @@ var RetryWhenSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 456 */ +/* 469 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54031,7 +56804,7 @@ var SampleSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 457 */ +/* 470 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54091,7 +56864,7 @@ function dispatchNotification(state) { /***/ }), -/* 458 */ +/* 471 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54214,13 +56987,13 @@ var SequenceEqualCompareToSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 459 */ +/* 472 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "share", function() { return share; }); -/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(442); +/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(455); /* harmony import */ var _refCount__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(30); /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(27); /** PURE_IMPORTS_START _multicast,_refCount,_Subject PURE_IMPORTS_END */ @@ -54237,7 +57010,7 @@ function share() { /***/ }), -/* 460 */ +/* 473 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54302,7 +57075,7 @@ function shareReplayOperator(_a) { /***/ }), -/* 461 */ +/* 474 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54382,7 +57155,7 @@ var SingleSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 462 */ +/* 475 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54424,7 +57197,7 @@ var SkipSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 463 */ +/* 476 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54486,7 +57259,7 @@ var SkipLastSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 464 */ +/* 477 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54547,7 +57320,7 @@ var SkipUntilSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 465 */ +/* 478 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54603,7 +57376,7 @@ var SkipWhileSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 466 */ +/* 479 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54632,13 +57405,13 @@ function startWith() { /***/ }), -/* 467 */ +/* 480 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeOn", function() { return subscribeOn; }); -/* harmony import */ var _observable_SubscribeOnObservable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(468); +/* harmony import */ var _observable_SubscribeOnObservable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(481); /** PURE_IMPORTS_START _observable_SubscribeOnObservable PURE_IMPORTS_END */ function subscribeOn(scheduler, delay) { @@ -54663,7 +57436,7 @@ var SubscribeOnOperator = /*@__PURE__*/ (function () { /***/ }), -/* 468 */ +/* 481 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54727,13 +57500,13 @@ var SubscribeOnObservable = /*@__PURE__*/ (function (_super) { /***/ }), -/* 469 */ +/* 482 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "switchAll", function() { return switchAll; }); -/* harmony import */ var _switchMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(470); +/* harmony import */ var _switchMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(483); /* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(25); /** PURE_IMPORTS_START _switchMap,_util_identity PURE_IMPORTS_END */ @@ -54745,7 +57518,7 @@ function switchAll() { /***/ }), -/* 470 */ +/* 483 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54839,13 +57612,13 @@ var SwitchMapSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 471 */ +/* 484 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "switchMapTo", function() { return switchMapTo; }); -/* harmony import */ var _switchMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(470); +/* harmony import */ var _switchMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(483); /** PURE_IMPORTS_START _switchMap PURE_IMPORTS_END */ function switchMapTo(innerObservable, resultSelector) { @@ -54855,7 +57628,7 @@ function switchMapTo(innerObservable, resultSelector) { /***/ }), -/* 472 */ +/* 485 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54905,7 +57678,7 @@ var TakeUntilSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 473 */ +/* 486 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54973,7 +57746,7 @@ var TakeWhileSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 474 */ +/* 487 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55061,7 +57834,7 @@ var TapSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 475 */ +/* 488 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55165,7 +57938,7 @@ var ThrottleSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 476 */ +/* 489 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55174,7 +57947,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(55); -/* harmony import */ var _throttle__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(475); +/* harmony import */ var _throttle__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(488); /** PURE_IMPORTS_START tslib,_Subscriber,_scheduler_async,_throttle PURE_IMPORTS_END */ @@ -55263,7 +58036,7 @@ function dispatchNext(arg) { /***/ }), -/* 477 */ +/* 490 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55271,7 +58044,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timeInterval", function() { return timeInterval; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TimeInterval", function() { return TimeInterval; }); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55); -/* harmony import */ var _scan__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(437); +/* harmony import */ var _scan__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(450); /* harmony import */ var _observable_defer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(90); /* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(66); /** PURE_IMPORTS_START _scheduler_async,_scan,_observable_defer,_map PURE_IMPORTS_END */ @@ -55307,7 +58080,7 @@ var TimeInterval = /*@__PURE__*/ (function () { /***/ }), -/* 478 */ +/* 491 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55315,7 +58088,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timeout", function() { return timeout; }); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55); /* harmony import */ var _util_TimeoutError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(64); -/* harmony import */ var _timeoutWith__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(479); +/* harmony import */ var _timeoutWith__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(492); /* harmony import */ var _observable_throwError__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49); /** PURE_IMPORTS_START _scheduler_async,_util_TimeoutError,_timeoutWith,_observable_throwError PURE_IMPORTS_END */ @@ -55332,7 +58105,7 @@ function timeout(due, scheduler) { /***/ }), -/* 479 */ +/* 492 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55340,7 +58113,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timeoutWith", function() { return timeoutWith; }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(55); -/* harmony import */ var _util_isDate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(411); +/* harmony import */ var _util_isDate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(424); /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69); /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(70); /** PURE_IMPORTS_START tslib,_scheduler_async,_util_isDate,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */ @@ -55414,7 +58187,7 @@ var TimeoutWithSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 480 */ +/* 493 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55444,13 +58217,13 @@ var Timestamp = /*@__PURE__*/ (function () { /***/ }), -/* 481 */ +/* 494 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return toArray; }); -/* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(436); +/* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(449); /** PURE_IMPORTS_START _reduce PURE_IMPORTS_END */ function toArrayReducer(arr, item, index) { @@ -55467,7 +58240,7 @@ function toArray() { /***/ }), -/* 482 */ +/* 495 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55547,7 +58320,7 @@ var WindowSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 483 */ +/* 496 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55637,7 +58410,7 @@ var WindowCountSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 484 */ +/* 497 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55807,7 +58580,7 @@ function dispatchWindowClose(state) { /***/ }), -/* 485 */ +/* 498 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55950,7 +58723,7 @@ var WindowToggleSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 486 */ +/* 499 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56047,7 +58820,7 @@ var WindowSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 487 */ +/* 500 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56142,7 +58915,7 @@ var WithLatestFromSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 488 */ +/* 501 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56164,7 +58937,7 @@ function zip() { /***/ }), -/* 489 */ +/* 502 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56180,17 +58953,17 @@ function zipAll(project) { /***/ }), -/* 490 */ +/* 503 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runCommand", function() { return runCommand; }); -/* harmony import */ var _utils_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(161); -/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(142); -/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(144); -/* harmony import */ var _utils_projects_tree__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(491); -/* harmony import */ var _utils_kibana__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(492); +/* harmony import */ var _utils_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(162); +/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(143); +/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(145); +/* harmony import */ var _utils_projects_tree__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(504); +/* harmony import */ var _utils_kibana__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(505); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } @@ -56272,13 +59045,13 @@ function toArray(value) { } /***/ }), -/* 491 */ +/* 504 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderProjectsTree", function() { return renderProjectsTree; }); -/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(112); +/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(235); /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); @@ -56425,7 +59198,7 @@ function addProjectToTree(tree, pathParts, project) { } /***/ }), -/* 492 */ +/* 505 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56433,12 +59206,12 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Kibana", function() { return Kibana; }); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var multimatch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(493); +/* harmony import */ var multimatch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(506); /* harmony import */ var multimatch__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(multimatch__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var is_path_inside__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(497); +/* harmony import */ var is_path_inside__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(510); /* harmony import */ var is_path_inside__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(is_path_inside__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _projects__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(144); -/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(272); +/* harmony import */ var _projects__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(145); +/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(288); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } @@ -56579,15 +59352,15 @@ class Kibana { } /***/ }), -/* 493 */ +/* 506 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const minimatch = __webpack_require__(148); -const arrayUnion = __webpack_require__(494); -const arrayDiffer = __webpack_require__(495); -const arrify = __webpack_require__(496); +const minimatch = __webpack_require__(149); +const arrayUnion = __webpack_require__(507); +const arrayDiffer = __webpack_require__(508); +const arrify = __webpack_require__(509); module.exports = (list, patterns, options = {}) => { list = arrify(list); @@ -56611,7 +59384,7 @@ module.exports = (list, patterns, options = {}) => { /***/ }), -/* 494 */ +/* 507 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -56623,7 +59396,7 @@ module.exports = (...arguments_) => { /***/ }), -/* 495 */ +/* 508 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -56638,7 +59411,7 @@ module.exports = arrayDiffer; /***/ }), -/* 496 */ +/* 509 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -56668,7 +59441,7 @@ module.exports = arrify; /***/ }), -/* 497 */ +/* 510 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -56696,15 +59469,15 @@ module.exports = (childPath, parentPath) => { /***/ }), -/* 498 */ +/* 511 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); -/* harmony import */ var _build_production_projects__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(499); +/* harmony import */ var _build_production_projects__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(512); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buildProductionProjects", function() { return _build_production_projects__WEBPACK_IMPORTED_MODULE_0__["buildProductionProjects"]; }); -/* harmony import */ var _prepare_project_dependencies__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(735); +/* harmony import */ var _prepare_project_dependencies__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(748); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "prepareExternalProjectDependencies", function() { return _prepare_project_dependencies__WEBPACK_IMPORTED_MODULE_1__["prepareExternalProjectDependencies"]; }); /* @@ -56729,23 +59502,23 @@ __webpack_require__.r(__webpack_exports__); /***/ }), -/* 499 */ +/* 512 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildProductionProjects", function() { return buildProductionProjects; }); -/* harmony import */ var cpy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(500); +/* harmony import */ var cpy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(513); /* harmony import */ var cpy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(cpy__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(281); +/* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(296); /* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(del__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(272); -/* harmony import */ var _utils_fs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(129); -/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(142); -/* harmony import */ var _utils_package_json__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(163); -/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(144); +/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(288); +/* harmony import */ var _utils_fs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(130); +/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(143); +/* harmony import */ var _utils_package_json__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(164); +/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(145); /* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with @@ -56877,21 +59650,21 @@ async function copyToBuild(project, kibanaRoot, buildRoot) { } /***/ }), -/* 500 */ +/* 513 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const EventEmitter = __webpack_require__(154); +const EventEmitter = __webpack_require__(155); const path = __webpack_require__(4); -const os = __webpack_require__(121); -const pAll = __webpack_require__(501); -const arrify = __webpack_require__(503); -const globby = __webpack_require__(504); -const isGlob = __webpack_require__(719); -const cpFile = __webpack_require__(720); -const junk = __webpack_require__(732); -const CpyError = __webpack_require__(733); +const os = __webpack_require__(120); +const pAll = __webpack_require__(514); +const arrify = __webpack_require__(516); +const globby = __webpack_require__(517); +const isGlob = __webpack_require__(732); +const cpFile = __webpack_require__(733); +const junk = __webpack_require__(745); +const CpyError = __webpack_require__(746); const defaultOptions = { ignoreJunk: true @@ -57010,12 +59783,12 @@ module.exports = (source, destination, { /***/ }), -/* 501 */ +/* 514 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const pMap = __webpack_require__(502); +const pMap = __webpack_require__(515); module.exports = (iterable, options) => pMap(iterable, element => element(), options); // TODO: Remove this for the next major release @@ -57023,7 +59796,7 @@ module.exports.default = module.exports; /***/ }), -/* 502 */ +/* 515 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -57102,7 +59875,7 @@ module.exports.default = pMap; /***/ }), -/* 503 */ +/* 516 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -57132,17 +59905,17 @@ module.exports = arrify; /***/ }), -/* 504 */ +/* 517 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const fs = __webpack_require__(132); -const arrayUnion = __webpack_require__(505); -const glob = __webpack_require__(507); -const fastGlob = __webpack_require__(512); -const dirGlob = __webpack_require__(712); -const gitignore = __webpack_require__(715); +const fs = __webpack_require__(133); +const arrayUnion = __webpack_require__(518); +const glob = __webpack_require__(520); +const fastGlob = __webpack_require__(525); +const dirGlob = __webpack_require__(725); +const gitignore = __webpack_require__(728); const DEFAULT_FILTER = () => false; @@ -57287,12 +60060,12 @@ module.exports.gitignore = gitignore; /***/ }), -/* 505 */ +/* 518 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var arrayUniq = __webpack_require__(506); +var arrayUniq = __webpack_require__(519); module.exports = function () { return arrayUniq([].concat.apply([], arguments)); @@ -57300,7 +60073,7 @@ module.exports = function () { /***/ }), -/* 506 */ +/* 519 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -57369,7 +60142,7 @@ if ('Set' in global) { /***/ }), -/* 507 */ +/* 520 */ /***/ (function(module, exports, __webpack_require__) { // Approach: @@ -57414,27 +60187,27 @@ if ('Set' in global) { module.exports = glob -var fs = __webpack_require__(132) -var rp = __webpack_require__(146) -var minimatch = __webpack_require__(148) +var fs = __webpack_require__(133) +var rp = __webpack_require__(147) +var minimatch = __webpack_require__(149) var Minimatch = minimatch.Minimatch -var inherits = __webpack_require__(508) -var EE = __webpack_require__(154).EventEmitter +var inherits = __webpack_require__(521) +var EE = __webpack_require__(155).EventEmitter var path = __webpack_require__(4) -var assert = __webpack_require__(138) -var isAbsolute = __webpack_require__(155) -var globSync = __webpack_require__(510) -var common = __webpack_require__(511) +var assert = __webpack_require__(139) +var isAbsolute = __webpack_require__(156) +var globSync = __webpack_require__(523) +var common = __webpack_require__(524) var alphasort = common.alphasort var alphasorti = common.alphasorti var setopts = common.setopts var ownProp = common.ownProp -var inflight = __webpack_require__(158) +var inflight = __webpack_require__(159) var util = __webpack_require__(111) var childrenIgnored = common.childrenIgnored var isIgnored = common.isIgnored -var once = __webpack_require__(160) +var once = __webpack_require__(161) function glob (pattern, options, cb) { if (typeof options === 'function') cb = options, options = {} @@ -58165,7 +60938,7 @@ Glob.prototype._stat2 = function (f, abs, er, stat, cb) { /***/ }), -/* 508 */ +/* 521 */ /***/ (function(module, exports, __webpack_require__) { try { @@ -58175,12 +60948,12 @@ try { module.exports = util.inherits; } catch (e) { /* istanbul ignore next */ - module.exports = __webpack_require__(509); + module.exports = __webpack_require__(522); } /***/ }), -/* 509 */ +/* 522 */ /***/ (function(module, exports) { if (typeof Object.create === 'function') { @@ -58213,22 +60986,22 @@ if (typeof Object.create === 'function') { /***/ }), -/* 510 */ +/* 523 */ /***/ (function(module, exports, __webpack_require__) { module.exports = globSync globSync.GlobSync = GlobSync -var fs = __webpack_require__(132) -var rp = __webpack_require__(146) -var minimatch = __webpack_require__(148) +var fs = __webpack_require__(133) +var rp = __webpack_require__(147) +var minimatch = __webpack_require__(149) var Minimatch = minimatch.Minimatch -var Glob = __webpack_require__(507).Glob +var Glob = __webpack_require__(520).Glob var util = __webpack_require__(111) var path = __webpack_require__(4) -var assert = __webpack_require__(138) -var isAbsolute = __webpack_require__(155) -var common = __webpack_require__(511) +var assert = __webpack_require__(139) +var isAbsolute = __webpack_require__(156) +var common = __webpack_require__(524) var alphasort = common.alphasort var alphasorti = common.alphasorti var setopts = common.setopts @@ -58705,7 +61478,7 @@ GlobSync.prototype._makeAbs = function (f) { /***/ }), -/* 511 */ +/* 524 */ /***/ (function(module, exports, __webpack_require__) { exports.alphasort = alphasort @@ -58723,8 +61496,8 @@ function ownProp (obj, field) { } var path = __webpack_require__(4) -var minimatch = __webpack_require__(148) -var isAbsolute = __webpack_require__(155) +var minimatch = __webpack_require__(149) +var isAbsolute = __webpack_require__(156) var Minimatch = minimatch.Minimatch function alphasorti (a, b) { @@ -58951,10 +61724,10 @@ function childrenIgnored (self, path) { /***/ }), -/* 512 */ +/* 525 */ /***/ (function(module, exports, __webpack_require__) { -const pkg = __webpack_require__(513); +const pkg = __webpack_require__(526); module.exports = pkg.async; module.exports.default = pkg.async; @@ -58967,19 +61740,19 @@ module.exports.generateTasks = pkg.generateTasks; /***/ }), -/* 513 */ +/* 526 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var optionsManager = __webpack_require__(514); -var taskManager = __webpack_require__(515); -var reader_async_1 = __webpack_require__(683); -var reader_stream_1 = __webpack_require__(707); -var reader_sync_1 = __webpack_require__(708); -var arrayUtils = __webpack_require__(710); -var streamUtils = __webpack_require__(711); +var optionsManager = __webpack_require__(527); +var taskManager = __webpack_require__(528); +var reader_async_1 = __webpack_require__(696); +var reader_stream_1 = __webpack_require__(720); +var reader_sync_1 = __webpack_require__(721); +var arrayUtils = __webpack_require__(723); +var streamUtils = __webpack_require__(724); /** * Synchronous API. */ @@ -59045,7 +61818,7 @@ function isString(source) { /***/ }), -/* 514 */ +/* 527 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -59083,13 +61856,13 @@ exports.prepare = prepare; /***/ }), -/* 515 */ +/* 528 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var patternUtils = __webpack_require__(516); +var patternUtils = __webpack_require__(529); /** * Generate tasks based on parent directory of each pattern. */ @@ -59180,16 +61953,16 @@ exports.convertPatternGroupToTask = convertPatternGroupToTask; /***/ }), -/* 516 */ +/* 529 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var path = __webpack_require__(4); -var globParent = __webpack_require__(517); -var isGlob = __webpack_require__(520); -var micromatch = __webpack_require__(521); +var globParent = __webpack_require__(530); +var isGlob = __webpack_require__(533); +var micromatch = __webpack_require__(534); var GLOBSTAR = '**'; /** * Return true for static pattern. @@ -59335,16 +62108,16 @@ exports.matchAny = matchAny; /***/ }), -/* 517 */ +/* 530 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var path = __webpack_require__(4); -var isglob = __webpack_require__(518); -var pathDirname = __webpack_require__(519); -var isWin32 = __webpack_require__(121).platform() === 'win32'; +var isglob = __webpack_require__(531); +var pathDirname = __webpack_require__(532); +var isWin32 = __webpack_require__(120).platform() === 'win32'; module.exports = function globParent(str) { // flip windows path separators @@ -59366,7 +62139,7 @@ module.exports = function globParent(str) { /***/ }), -/* 518 */ +/* 531 */ /***/ (function(module, exports, __webpack_require__) { /*! @@ -59376,7 +62149,7 @@ module.exports = function globParent(str) { * Licensed under the MIT License. */ -var isExtglob = __webpack_require__(300); +var isExtglob = __webpack_require__(315); module.exports = function isGlob(str) { if (typeof str !== 'string' || str === '') { @@ -59397,7 +62170,7 @@ module.exports = function isGlob(str) { /***/ }), -/* 519 */ +/* 532 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -59547,7 +62320,7 @@ module.exports.win32 = win32; /***/ }), -/* 520 */ +/* 533 */ /***/ (function(module, exports, __webpack_require__) { /*! @@ -59557,7 +62330,7 @@ module.exports.win32 = win32; * Released under the MIT License. */ -var isExtglob = __webpack_require__(300); +var isExtglob = __webpack_require__(315); var chars = { '{': '}', '(': ')', '[': ']'}; module.exports = function isGlob(str, options) { @@ -59599,7 +62372,7 @@ module.exports = function isGlob(str, options) { /***/ }), -/* 521 */ +/* 534 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -59610,18 +62383,18 @@ module.exports = function isGlob(str, options) { */ var util = __webpack_require__(111); -var braces = __webpack_require__(522); -var toRegex = __webpack_require__(635); -var extend = __webpack_require__(643); +var braces = __webpack_require__(535); +var toRegex = __webpack_require__(648); +var extend = __webpack_require__(656); /** * Local dependencies */ -var compilers = __webpack_require__(646); -var parsers = __webpack_require__(679); -var cache = __webpack_require__(680); -var utils = __webpack_require__(681); +var compilers = __webpack_require__(659); +var parsers = __webpack_require__(692); +var cache = __webpack_require__(693); +var utils = __webpack_require__(694); var MAX_LENGTH = 1024 * 64; /** @@ -60483,7 +63256,7 @@ module.exports = micromatch; /***/ }), -/* 522 */ +/* 535 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -60493,18 +63266,18 @@ module.exports = micromatch; * Module dependencies */ -var toRegex = __webpack_require__(523); -var unique = __webpack_require__(537); -var extend = __webpack_require__(532); +var toRegex = __webpack_require__(536); +var unique = __webpack_require__(550); +var extend = __webpack_require__(545); /** * Local dependencies */ -var compilers = __webpack_require__(538); -var parsers = __webpack_require__(555); -var Braces = __webpack_require__(565); -var utils = __webpack_require__(539); +var compilers = __webpack_require__(551); +var parsers = __webpack_require__(568); +var Braces = __webpack_require__(578); +var utils = __webpack_require__(552); var MAX_LENGTH = 1024 * 64; var cache = {}; @@ -60808,15 +63581,15 @@ module.exports = braces; /***/ }), -/* 523 */ +/* 536 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var define = __webpack_require__(524); -var extend = __webpack_require__(532); -var not = __webpack_require__(534); +var define = __webpack_require__(537); +var extend = __webpack_require__(545); +var not = __webpack_require__(547); var MAX_LENGTH = 1024 * 64; /** @@ -60963,7 +63736,7 @@ module.exports.makeRe = makeRe; /***/ }), -/* 524 */ +/* 537 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -60976,7 +63749,7 @@ module.exports.makeRe = makeRe; -var isDescriptor = __webpack_require__(525); +var isDescriptor = __webpack_require__(538); module.exports = function defineProperty(obj, prop, val) { if (typeof obj !== 'object' && typeof obj !== 'function') { @@ -61001,7 +63774,7 @@ module.exports = function defineProperty(obj, prop, val) { /***/ }), -/* 525 */ +/* 538 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -61014,9 +63787,9 @@ module.exports = function defineProperty(obj, prop, val) { -var typeOf = __webpack_require__(526); -var isAccessor = __webpack_require__(527); -var isData = __webpack_require__(530); +var typeOf = __webpack_require__(539); +var isAccessor = __webpack_require__(540); +var isData = __webpack_require__(543); module.exports = function isDescriptor(obj, key) { if (typeOf(obj) !== 'object') { @@ -61030,7 +63803,7 @@ module.exports = function isDescriptor(obj, key) { /***/ }), -/* 526 */ +/* 539 */ /***/ (function(module, exports) { var toString = Object.prototype.toString; @@ -61183,7 +63956,7 @@ function isBuffer(val) { /***/ }), -/* 527 */ +/* 540 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -61196,7 +63969,7 @@ function isBuffer(val) { -var typeOf = __webpack_require__(528); +var typeOf = __webpack_require__(541); // accessor descriptor properties var accessor = { @@ -61259,10 +64032,10 @@ module.exports = isAccessorDescriptor; /***/ }), -/* 528 */ +/* 541 */ /***/ (function(module, exports, __webpack_require__) { -var isBuffer = __webpack_require__(529); +var isBuffer = __webpack_require__(542); var toString = Object.prototype.toString; /** @@ -61381,7 +64154,7 @@ module.exports = function kindOf(val) { /***/ }), -/* 529 */ +/* 542 */ /***/ (function(module, exports) { /*! @@ -61408,7 +64181,7 @@ function isSlowBuffer (obj) { /***/ }), -/* 530 */ +/* 543 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -61421,7 +64194,7 @@ function isSlowBuffer (obj) { -var typeOf = __webpack_require__(531); +var typeOf = __webpack_require__(544); // data descriptor properties var data = { @@ -61470,10 +64243,10 @@ module.exports = isDataDescriptor; /***/ }), -/* 531 */ +/* 544 */ /***/ (function(module, exports, __webpack_require__) { -var isBuffer = __webpack_require__(529); +var isBuffer = __webpack_require__(542); var toString = Object.prototype.toString; /** @@ -61592,13 +64365,13 @@ module.exports = function kindOf(val) { /***/ }), -/* 532 */ +/* 545 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isObject = __webpack_require__(533); +var isObject = __webpack_require__(546); module.exports = function extend(o/*, objects*/) { if (!isObject(o)) { o = {}; } @@ -61632,7 +64405,7 @@ function hasOwn(obj, key) { /***/ }), -/* 533 */ +/* 546 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -61652,13 +64425,13 @@ module.exports = function isExtendable(val) { /***/ }), -/* 534 */ +/* 547 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var extend = __webpack_require__(535); +var extend = __webpack_require__(548); /** * The main export is a function that takes a `pattern` string and an `options` object. @@ -61725,13 +64498,13 @@ module.exports = toRegex; /***/ }), -/* 535 */ +/* 548 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isObject = __webpack_require__(536); +var isObject = __webpack_require__(549); module.exports = function extend(o/*, objects*/) { if (!isObject(o)) { o = {}; } @@ -61765,7 +64538,7 @@ function hasOwn(obj, key) { /***/ }), -/* 536 */ +/* 549 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -61785,7 +64558,7 @@ module.exports = function isExtendable(val) { /***/ }), -/* 537 */ +/* 550 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -61835,13 +64608,13 @@ module.exports.immutable = function uniqueImmutable(arr) { /***/ }), -/* 538 */ +/* 551 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var utils = __webpack_require__(539); +var utils = __webpack_require__(552); module.exports = function(braces, options) { braces.compiler @@ -62124,25 +64897,25 @@ function hasQueue(node) { /***/ }), -/* 539 */ +/* 552 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var splitString = __webpack_require__(540); +var splitString = __webpack_require__(553); var utils = module.exports; /** * Module dependencies */ -utils.extend = __webpack_require__(532); -utils.flatten = __webpack_require__(546); -utils.isObject = __webpack_require__(544); -utils.fillRange = __webpack_require__(547); -utils.repeat = __webpack_require__(554); -utils.unique = __webpack_require__(537); +utils.extend = __webpack_require__(545); +utils.flatten = __webpack_require__(559); +utils.isObject = __webpack_require__(557); +utils.fillRange = __webpack_require__(560); +utils.repeat = __webpack_require__(567); +utils.unique = __webpack_require__(550); utils.define = function(obj, key, val) { Object.defineProperty(obj, key, { @@ -62474,7 +65247,7 @@ utils.escapeRegex = function(str) { /***/ }), -/* 540 */ +/* 553 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -62487,7 +65260,7 @@ utils.escapeRegex = function(str) { -var extend = __webpack_require__(541); +var extend = __webpack_require__(554); module.exports = function(str, options, fn) { if (typeof str !== 'string') { @@ -62652,14 +65425,14 @@ function keepEscaping(opts, str, idx) { /***/ }), -/* 541 */ +/* 554 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isExtendable = __webpack_require__(542); -var assignSymbols = __webpack_require__(545); +var isExtendable = __webpack_require__(555); +var assignSymbols = __webpack_require__(558); module.exports = Object.assign || function(obj/*, objects*/) { if (obj === null || typeof obj === 'undefined') { @@ -62719,7 +65492,7 @@ function isEnum(obj, key) { /***/ }), -/* 542 */ +/* 555 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -62732,7 +65505,7 @@ function isEnum(obj, key) { -var isPlainObject = __webpack_require__(543); +var isPlainObject = __webpack_require__(556); module.exports = function isExtendable(val) { return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); @@ -62740,7 +65513,7 @@ module.exports = function isExtendable(val) { /***/ }), -/* 543 */ +/* 556 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -62753,7 +65526,7 @@ module.exports = function isExtendable(val) { -var isObject = __webpack_require__(544); +var isObject = __webpack_require__(557); function isObjectObject(o) { return isObject(o) === true @@ -62784,7 +65557,7 @@ module.exports = function isPlainObject(o) { /***/ }), -/* 544 */ +/* 557 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -62803,7 +65576,7 @@ module.exports = function isObject(val) { /***/ }), -/* 545 */ +/* 558 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -62850,7 +65623,7 @@ module.exports = function(receiver, objects) { /***/ }), -/* 546 */ +/* 559 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -62879,7 +65652,7 @@ function flat(arr, res) { /***/ }), -/* 547 */ +/* 560 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -62893,10 +65666,10 @@ function flat(arr, res) { var util = __webpack_require__(111); -var isNumber = __webpack_require__(548); -var extend = __webpack_require__(550); -var repeat = __webpack_require__(552); -var toRegex = __webpack_require__(553); +var isNumber = __webpack_require__(561); +var extend = __webpack_require__(563); +var repeat = __webpack_require__(565); +var toRegex = __webpack_require__(566); /** * Return a range of numbers or letters. @@ -63094,7 +65867,7 @@ module.exports = fillRange; /***/ }), -/* 548 */ +/* 561 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -63107,7 +65880,7 @@ module.exports = fillRange; -var typeOf = __webpack_require__(549); +var typeOf = __webpack_require__(562); module.exports = function isNumber(num) { var type = typeOf(num); @@ -63123,10 +65896,10 @@ module.exports = function isNumber(num) { /***/ }), -/* 549 */ +/* 562 */ /***/ (function(module, exports, __webpack_require__) { -var isBuffer = __webpack_require__(529); +var isBuffer = __webpack_require__(542); var toString = Object.prototype.toString; /** @@ -63245,13 +66018,13 @@ module.exports = function kindOf(val) { /***/ }), -/* 550 */ +/* 563 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isObject = __webpack_require__(551); +var isObject = __webpack_require__(564); module.exports = function extend(o/*, objects*/) { if (!isObject(o)) { o = {}; } @@ -63285,7 +66058,7 @@ function hasOwn(obj, key) { /***/ }), -/* 551 */ +/* 564 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -63305,7 +66078,7 @@ module.exports = function isExtendable(val) { /***/ }), -/* 552 */ +/* 565 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -63382,7 +66155,7 @@ function repeat(str, num) { /***/ }), -/* 553 */ +/* 566 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -63395,8 +66168,8 @@ function repeat(str, num) { -var repeat = __webpack_require__(552); -var isNumber = __webpack_require__(548); +var repeat = __webpack_require__(565); +var isNumber = __webpack_require__(561); var cache = {}; function toRegexRange(min, max, options) { @@ -63683,7 +66456,7 @@ module.exports = toRegexRange; /***/ }), -/* 554 */ +/* 567 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -63708,14 +66481,14 @@ module.exports = function repeat(ele, num) { /***/ }), -/* 555 */ +/* 568 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Node = __webpack_require__(556); -var utils = __webpack_require__(539); +var Node = __webpack_require__(569); +var utils = __webpack_require__(552); /** * Braces parsers @@ -64075,15 +66848,15 @@ function concatNodes(pos, node, parent, options) { /***/ }), -/* 556 */ +/* 569 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isObject = __webpack_require__(544); -var define = __webpack_require__(557); -var utils = __webpack_require__(564); +var isObject = __webpack_require__(557); +var define = __webpack_require__(570); +var utils = __webpack_require__(577); var ownNames; /** @@ -64574,7 +67347,7 @@ exports = module.exports = Node; /***/ }), -/* 557 */ +/* 570 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -64587,7 +67360,7 @@ exports = module.exports = Node; -var isDescriptor = __webpack_require__(558); +var isDescriptor = __webpack_require__(571); module.exports = function defineProperty(obj, prop, val) { if (typeof obj !== 'object' && typeof obj !== 'function') { @@ -64612,7 +67385,7 @@ module.exports = function defineProperty(obj, prop, val) { /***/ }), -/* 558 */ +/* 571 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -64625,9 +67398,9 @@ module.exports = function defineProperty(obj, prop, val) { -var typeOf = __webpack_require__(559); -var isAccessor = __webpack_require__(560); -var isData = __webpack_require__(562); +var typeOf = __webpack_require__(572); +var isAccessor = __webpack_require__(573); +var isData = __webpack_require__(575); module.exports = function isDescriptor(obj, key) { if (typeOf(obj) !== 'object') { @@ -64641,7 +67414,7 @@ module.exports = function isDescriptor(obj, key) { /***/ }), -/* 559 */ +/* 572 */ /***/ (function(module, exports) { var toString = Object.prototype.toString; @@ -64776,7 +67549,7 @@ function isBuffer(val) { /***/ }), -/* 560 */ +/* 573 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -64789,7 +67562,7 @@ function isBuffer(val) { -var typeOf = __webpack_require__(561); +var typeOf = __webpack_require__(574); // accessor descriptor properties var accessor = { @@ -64852,7 +67625,7 @@ module.exports = isAccessorDescriptor; /***/ }), -/* 561 */ +/* 574 */ /***/ (function(module, exports) { var toString = Object.prototype.toString; @@ -64987,7 +67760,7 @@ function isBuffer(val) { /***/ }), -/* 562 */ +/* 575 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -65000,7 +67773,7 @@ function isBuffer(val) { -var typeOf = __webpack_require__(563); +var typeOf = __webpack_require__(576); module.exports = function isDataDescriptor(obj, prop) { // data descriptor properties @@ -65043,7 +67816,7 @@ module.exports = function isDataDescriptor(obj, prop) { /***/ }), -/* 563 */ +/* 576 */ /***/ (function(module, exports) { var toString = Object.prototype.toString; @@ -65178,13 +67951,13 @@ function isBuffer(val) { /***/ }), -/* 564 */ +/* 577 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var typeOf = __webpack_require__(549); +var typeOf = __webpack_require__(562); var utils = module.exports; /** @@ -66204,17 +68977,17 @@ function assert(val, message) { /***/ }), -/* 565 */ +/* 578 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var extend = __webpack_require__(532); -var Snapdragon = __webpack_require__(566); -var compilers = __webpack_require__(538); -var parsers = __webpack_require__(555); -var utils = __webpack_require__(539); +var extend = __webpack_require__(545); +var Snapdragon = __webpack_require__(579); +var compilers = __webpack_require__(551); +var parsers = __webpack_require__(568); +var utils = __webpack_require__(552); /** * Customize Snapdragon parser and renderer @@ -66315,17 +69088,17 @@ module.exports = Braces; /***/ }), -/* 566 */ +/* 579 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Base = __webpack_require__(567); -var define = __webpack_require__(593); -var Compiler = __webpack_require__(603); -var Parser = __webpack_require__(632); -var utils = __webpack_require__(612); +var Base = __webpack_require__(580); +var define = __webpack_require__(606); +var Compiler = __webpack_require__(616); +var Parser = __webpack_require__(645); +var utils = __webpack_require__(625); var regexCache = {}; var cache = {}; @@ -66496,20 +69269,20 @@ module.exports.Parser = Parser; /***/ }), -/* 567 */ +/* 580 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var util = __webpack_require__(111); -var define = __webpack_require__(568); -var CacheBase = __webpack_require__(569); -var Emitter = __webpack_require__(570); -var isObject = __webpack_require__(544); -var merge = __webpack_require__(587); -var pascal = __webpack_require__(590); -var cu = __webpack_require__(591); +var define = __webpack_require__(581); +var CacheBase = __webpack_require__(582); +var Emitter = __webpack_require__(583); +var isObject = __webpack_require__(557); +var merge = __webpack_require__(600); +var pascal = __webpack_require__(603); +var cu = __webpack_require__(604); /** * Optionally define a custom `cache` namespace to use. @@ -66938,7 +69711,7 @@ module.exports.namespace = namespace; /***/ }), -/* 568 */ +/* 581 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -66951,7 +69724,7 @@ module.exports.namespace = namespace; -var isDescriptor = __webpack_require__(558); +var isDescriptor = __webpack_require__(571); module.exports = function defineProperty(obj, prop, val) { if (typeof obj !== 'object' && typeof obj !== 'function') { @@ -66976,21 +69749,21 @@ module.exports = function defineProperty(obj, prop, val) { /***/ }), -/* 569 */ +/* 582 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isObject = __webpack_require__(544); -var Emitter = __webpack_require__(570); -var visit = __webpack_require__(571); -var toPath = __webpack_require__(574); -var union = __webpack_require__(575); -var del = __webpack_require__(579); -var get = __webpack_require__(577); -var has = __webpack_require__(584); -var set = __webpack_require__(578); +var isObject = __webpack_require__(557); +var Emitter = __webpack_require__(583); +var visit = __webpack_require__(584); +var toPath = __webpack_require__(587); +var union = __webpack_require__(588); +var del = __webpack_require__(592); +var get = __webpack_require__(590); +var has = __webpack_require__(597); +var set = __webpack_require__(591); /** * Create a `Cache` constructor that when instantiated will @@ -67244,7 +70017,7 @@ module.exports.namespace = namespace; /***/ }), -/* 570 */ +/* 583 */ /***/ (function(module, exports, __webpack_require__) { @@ -67413,7 +70186,7 @@ Emitter.prototype.hasListeners = function(event){ /***/ }), -/* 571 */ +/* 584 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67426,8 +70199,8 @@ Emitter.prototype.hasListeners = function(event){ -var visit = __webpack_require__(572); -var mapVisit = __webpack_require__(573); +var visit = __webpack_require__(585); +var mapVisit = __webpack_require__(586); module.exports = function(collection, method, val) { var result; @@ -67450,7 +70223,7 @@ module.exports = function(collection, method, val) { /***/ }), -/* 572 */ +/* 585 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67463,7 +70236,7 @@ module.exports = function(collection, method, val) { -var isObject = __webpack_require__(544); +var isObject = __webpack_require__(557); module.exports = function visit(thisArg, method, target, val) { if (!isObject(thisArg) && typeof thisArg !== 'function') { @@ -67490,14 +70263,14 @@ module.exports = function visit(thisArg, method, target, val) { /***/ }), -/* 573 */ +/* 586 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var util = __webpack_require__(111); -var visit = __webpack_require__(572); +var visit = __webpack_require__(585); /** * Map `visit` over an array of objects. @@ -67534,7 +70307,7 @@ function isObject(val) { /***/ }), -/* 574 */ +/* 587 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67547,7 +70320,7 @@ function isObject(val) { -var typeOf = __webpack_require__(549); +var typeOf = __webpack_require__(562); module.exports = function toPath(args) { if (typeOf(args) !== 'arguments') { @@ -67574,16 +70347,16 @@ function filter(arr) { /***/ }), -/* 575 */ +/* 588 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isObject = __webpack_require__(536); -var union = __webpack_require__(576); -var get = __webpack_require__(577); -var set = __webpack_require__(578); +var isObject = __webpack_require__(549); +var union = __webpack_require__(589); +var get = __webpack_require__(590); +var set = __webpack_require__(591); module.exports = function unionValue(obj, prop, value) { if (!isObject(obj)) { @@ -67611,7 +70384,7 @@ function arrayify(val) { /***/ }), -/* 576 */ +/* 589 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67647,7 +70420,7 @@ module.exports = function union(init) { /***/ }), -/* 577 */ +/* 590 */ /***/ (function(module, exports) { /*! @@ -67703,7 +70476,7 @@ function toString(val) { /***/ }), -/* 578 */ +/* 591 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67716,10 +70489,10 @@ function toString(val) { -var split = __webpack_require__(540); -var extend = __webpack_require__(535); -var isPlainObject = __webpack_require__(543); -var isObject = __webpack_require__(536); +var split = __webpack_require__(553); +var extend = __webpack_require__(548); +var isPlainObject = __webpack_require__(556); +var isObject = __webpack_require__(549); module.exports = function(obj, prop, val) { if (!isObject(obj)) { @@ -67765,7 +70538,7 @@ function isValidKey(key) { /***/ }), -/* 579 */ +/* 592 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67778,8 +70551,8 @@ function isValidKey(key) { -var isObject = __webpack_require__(544); -var has = __webpack_require__(580); +var isObject = __webpack_require__(557); +var has = __webpack_require__(593); module.exports = function unset(obj, prop) { if (!isObject(obj)) { @@ -67804,7 +70577,7 @@ module.exports = function unset(obj, prop) { /***/ }), -/* 580 */ +/* 593 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67817,9 +70590,9 @@ module.exports = function unset(obj, prop) { -var isObject = __webpack_require__(581); -var hasValues = __webpack_require__(583); -var get = __webpack_require__(577); +var isObject = __webpack_require__(594); +var hasValues = __webpack_require__(596); +var get = __webpack_require__(590); module.exports = function(obj, prop, noZero) { if (isObject(obj)) { @@ -67830,7 +70603,7 @@ module.exports = function(obj, prop, noZero) { /***/ }), -/* 581 */ +/* 594 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67843,7 +70616,7 @@ module.exports = function(obj, prop, noZero) { -var isArray = __webpack_require__(582); +var isArray = __webpack_require__(595); module.exports = function isObject(val) { return val != null && typeof val === 'object' && isArray(val) === false; @@ -67851,7 +70624,7 @@ module.exports = function isObject(val) { /***/ }), -/* 582 */ +/* 595 */ /***/ (function(module, exports) { var toString = {}.toString; @@ -67862,7 +70635,7 @@ module.exports = Array.isArray || function (arr) { /***/ }), -/* 583 */ +/* 596 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67905,7 +70678,7 @@ module.exports = function hasValue(o, noZero) { /***/ }), -/* 584 */ +/* 597 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67918,9 +70691,9 @@ module.exports = function hasValue(o, noZero) { -var isObject = __webpack_require__(544); -var hasValues = __webpack_require__(585); -var get = __webpack_require__(577); +var isObject = __webpack_require__(557); +var hasValues = __webpack_require__(598); +var get = __webpack_require__(590); module.exports = function(val, prop) { return hasValues(isObject(val) && prop ? get(val, prop) : val); @@ -67928,7 +70701,7 @@ module.exports = function(val, prop) { /***/ }), -/* 585 */ +/* 598 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67941,8 +70714,8 @@ module.exports = function(val, prop) { -var typeOf = __webpack_require__(586); -var isNumber = __webpack_require__(548); +var typeOf = __webpack_require__(599); +var isNumber = __webpack_require__(561); module.exports = function hasValue(val) { // is-number checks for NaN and other edge cases @@ -67995,10 +70768,10 @@ module.exports = function hasValue(val) { /***/ }), -/* 586 */ +/* 599 */ /***/ (function(module, exports, __webpack_require__) { -var isBuffer = __webpack_require__(529); +var isBuffer = __webpack_require__(542); var toString = Object.prototype.toString; /** @@ -68120,14 +70893,14 @@ module.exports = function kindOf(val) { /***/ }), -/* 587 */ +/* 600 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isExtendable = __webpack_require__(588); -var forIn = __webpack_require__(589); +var isExtendable = __webpack_require__(601); +var forIn = __webpack_require__(602); function mixinDeep(target, objects) { var len = arguments.length, i = 0; @@ -68191,7 +70964,7 @@ module.exports = mixinDeep; /***/ }), -/* 588 */ +/* 601 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -68204,7 +70977,7 @@ module.exports = mixinDeep; -var isPlainObject = __webpack_require__(543); +var isPlainObject = __webpack_require__(556); module.exports = function isExtendable(val) { return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); @@ -68212,7 +70985,7 @@ module.exports = function isExtendable(val) { /***/ }), -/* 589 */ +/* 602 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -68235,7 +71008,7 @@ module.exports = function forIn(obj, fn, thisArg) { /***/ }), -/* 590 */ +/* 603 */ /***/ (function(module, exports) { /*! @@ -68262,14 +71035,14 @@ module.exports = pascalcase; /***/ }), -/* 591 */ +/* 604 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var util = __webpack_require__(111); -var utils = __webpack_require__(592); +var utils = __webpack_require__(605); /** * Expose class utils @@ -68634,7 +71407,7 @@ cu.bubble = function(Parent, events) { /***/ }), -/* 592 */ +/* 605 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -68648,10 +71421,10 @@ var utils = {}; * Lazily required module dependencies */ -utils.union = __webpack_require__(576); -utils.define = __webpack_require__(593); -utils.isObj = __webpack_require__(544); -utils.staticExtend = __webpack_require__(600); +utils.union = __webpack_require__(589); +utils.define = __webpack_require__(606); +utils.isObj = __webpack_require__(557); +utils.staticExtend = __webpack_require__(613); /** @@ -68662,7 +71435,7 @@ module.exports = utils; /***/ }), -/* 593 */ +/* 606 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -68675,7 +71448,7 @@ module.exports = utils; -var isDescriptor = __webpack_require__(594); +var isDescriptor = __webpack_require__(607); module.exports = function defineProperty(obj, prop, val) { if (typeof obj !== 'object' && typeof obj !== 'function') { @@ -68700,7 +71473,7 @@ module.exports = function defineProperty(obj, prop, val) { /***/ }), -/* 594 */ +/* 607 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -68713,9 +71486,9 @@ module.exports = function defineProperty(obj, prop, val) { -var typeOf = __webpack_require__(595); -var isAccessor = __webpack_require__(596); -var isData = __webpack_require__(598); +var typeOf = __webpack_require__(608); +var isAccessor = __webpack_require__(609); +var isData = __webpack_require__(611); module.exports = function isDescriptor(obj, key) { if (typeOf(obj) !== 'object') { @@ -68729,7 +71502,7 @@ module.exports = function isDescriptor(obj, key) { /***/ }), -/* 595 */ +/* 608 */ /***/ (function(module, exports) { var toString = Object.prototype.toString; @@ -68882,7 +71655,7 @@ function isBuffer(val) { /***/ }), -/* 596 */ +/* 609 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -68895,7 +71668,7 @@ function isBuffer(val) { -var typeOf = __webpack_require__(597); +var typeOf = __webpack_require__(610); // accessor descriptor properties var accessor = { @@ -68958,10 +71731,10 @@ module.exports = isAccessorDescriptor; /***/ }), -/* 597 */ +/* 610 */ /***/ (function(module, exports, __webpack_require__) { -var isBuffer = __webpack_require__(529); +var isBuffer = __webpack_require__(542); var toString = Object.prototype.toString; /** @@ -69080,7 +71853,7 @@ module.exports = function kindOf(val) { /***/ }), -/* 598 */ +/* 611 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -69093,7 +71866,7 @@ module.exports = function kindOf(val) { -var typeOf = __webpack_require__(599); +var typeOf = __webpack_require__(612); // data descriptor properties var data = { @@ -69142,10 +71915,10 @@ module.exports = isDataDescriptor; /***/ }), -/* 599 */ +/* 612 */ /***/ (function(module, exports, __webpack_require__) { -var isBuffer = __webpack_require__(529); +var isBuffer = __webpack_require__(542); var toString = Object.prototype.toString; /** @@ -69264,7 +72037,7 @@ module.exports = function kindOf(val) { /***/ }), -/* 600 */ +/* 613 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -69277,8 +72050,8 @@ module.exports = function kindOf(val) { -var copy = __webpack_require__(601); -var define = __webpack_require__(593); +var copy = __webpack_require__(614); +var define = __webpack_require__(606); var util = __webpack_require__(111); /** @@ -69361,15 +72134,15 @@ module.exports = extend; /***/ }), -/* 601 */ +/* 614 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var typeOf = __webpack_require__(549); -var copyDescriptor = __webpack_require__(602); -var define = __webpack_require__(593); +var typeOf = __webpack_require__(562); +var copyDescriptor = __webpack_require__(615); +var define = __webpack_require__(606); /** * Copy static properties, prototype properties, and descriptors from one object to another. @@ -69542,7 +72315,7 @@ module.exports.has = has; /***/ }), -/* 602 */ +/* 615 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -69630,16 +72403,16 @@ function isObject(val) { /***/ }), -/* 603 */ +/* 616 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var use = __webpack_require__(604); -var define = __webpack_require__(593); -var debug = __webpack_require__(606)('snapdragon:compiler'); -var utils = __webpack_require__(612); +var use = __webpack_require__(617); +var define = __webpack_require__(606); +var debug = __webpack_require__(619)('snapdragon:compiler'); +var utils = __webpack_require__(625); /** * Create a new `Compiler` with the given `options`. @@ -69793,7 +72566,7 @@ Compiler.prototype = { // source map support if (opts.sourcemap) { - var sourcemaps = __webpack_require__(631); + var sourcemaps = __webpack_require__(644); sourcemaps(this); this.mapVisit(this.ast.nodes); this.applySourceMaps(); @@ -69814,7 +72587,7 @@ module.exports = Compiler; /***/ }), -/* 604 */ +/* 617 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -69827,7 +72600,7 @@ module.exports = Compiler; -var utils = __webpack_require__(605); +var utils = __webpack_require__(618); module.exports = function base(app, opts) { if (!utils.isObject(app) && typeof app !== 'function') { @@ -69942,7 +72715,7 @@ module.exports = function base(app, opts) { /***/ }), -/* 605 */ +/* 618 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -69956,8 +72729,8 @@ var utils = {}; * Lazily required module dependencies */ -utils.define = __webpack_require__(593); -utils.isObject = __webpack_require__(544); +utils.define = __webpack_require__(606); +utils.isObject = __webpack_require__(557); utils.isString = function(val) { @@ -69972,7 +72745,7 @@ module.exports = utils; /***/ }), -/* 606 */ +/* 619 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -69981,14 +72754,14 @@ module.exports = utils; */ if (typeof process !== 'undefined' && process.type === 'renderer') { - module.exports = __webpack_require__(607); + module.exports = __webpack_require__(620); } else { - module.exports = __webpack_require__(610); + module.exports = __webpack_require__(623); } /***/ }), -/* 607 */ +/* 620 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -69997,7 +72770,7 @@ if (typeof process !== 'undefined' && process.type === 'renderer') { * Expose `debug()` as the module. */ -exports = module.exports = __webpack_require__(608); +exports = module.exports = __webpack_require__(621); exports.log = log; exports.formatArgs = formatArgs; exports.save = save; @@ -70179,7 +72952,7 @@ function localstorage() { /***/ }), -/* 608 */ +/* 621 */ /***/ (function(module, exports, __webpack_require__) { @@ -70195,7 +72968,7 @@ exports.coerce = coerce; exports.disable = disable; exports.enable = enable; exports.enabled = enabled; -exports.humanize = __webpack_require__(609); +exports.humanize = __webpack_require__(622); /** * The currently active debug mode names, and names to skip. @@ -70387,7 +73160,7 @@ function coerce(val) { /***/ }), -/* 609 */ +/* 622 */ /***/ (function(module, exports) { /** @@ -70545,14 +73318,14 @@ function plural(ms, n, name) { /***/ }), -/* 610 */ +/* 623 */ /***/ (function(module, exports, __webpack_require__) { /** * Module dependencies. */ -var tty = __webpack_require__(278); +var tty = __webpack_require__(121); var util = __webpack_require__(111); /** @@ -70561,7 +73334,7 @@ var util = __webpack_require__(111); * Expose `debug()` as the module. */ -exports = module.exports = __webpack_require__(608); +exports = module.exports = __webpack_require__(621); exports.init = init; exports.log = log; exports.formatArgs = formatArgs; @@ -70733,14 +73506,14 @@ function createWritableStdioStream (fd) { break; case 'FILE': - var fs = __webpack_require__(132); + var fs = __webpack_require__(133); stream = new fs.SyncWriteStream(fd, { autoClose: false }); stream._type = 'fs'; break; case 'PIPE': case 'TCP': - var net = __webpack_require__(611); + var net = __webpack_require__(624); stream = new net.Socket({ fd: fd, readable: false, @@ -70799,13 +73572,13 @@ exports.enable(load()); /***/ }), -/* 611 */ +/* 624 */ /***/ (function(module, exports) { module.exports = require("net"); /***/ }), -/* 612 */ +/* 625 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -70815,9 +73588,9 @@ module.exports = require("net"); * Module dependencies */ -exports.extend = __webpack_require__(535); -exports.SourceMap = __webpack_require__(613); -exports.sourceMapResolve = __webpack_require__(624); +exports.extend = __webpack_require__(548); +exports.SourceMap = __webpack_require__(626); +exports.sourceMapResolve = __webpack_require__(637); /** * Convert backslash in the given string to forward slashes @@ -70860,7 +73633,7 @@ exports.last = function(arr, n) { /***/ }), -/* 613 */ +/* 626 */ /***/ (function(module, exports, __webpack_require__) { /* @@ -70868,13 +73641,13 @@ exports.last = function(arr, n) { * Licensed under the New BSD license. See LICENSE.txt or: * http://opensource.org/licenses/BSD-3-Clause */ -exports.SourceMapGenerator = __webpack_require__(614).SourceMapGenerator; -exports.SourceMapConsumer = __webpack_require__(620).SourceMapConsumer; -exports.SourceNode = __webpack_require__(623).SourceNode; +exports.SourceMapGenerator = __webpack_require__(627).SourceMapGenerator; +exports.SourceMapConsumer = __webpack_require__(633).SourceMapConsumer; +exports.SourceNode = __webpack_require__(636).SourceNode; /***/ }), -/* 614 */ +/* 627 */ /***/ (function(module, exports, __webpack_require__) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -70884,10 +73657,10 @@ exports.SourceNode = __webpack_require__(623).SourceNode; * http://opensource.org/licenses/BSD-3-Clause */ -var base64VLQ = __webpack_require__(615); -var util = __webpack_require__(617); -var ArraySet = __webpack_require__(618).ArraySet; -var MappingList = __webpack_require__(619).MappingList; +var base64VLQ = __webpack_require__(628); +var util = __webpack_require__(630); +var ArraySet = __webpack_require__(631).ArraySet; +var MappingList = __webpack_require__(632).MappingList; /** * An instance of the SourceMapGenerator represents a source map which is @@ -71296,7 +74069,7 @@ exports.SourceMapGenerator = SourceMapGenerator; /***/ }), -/* 615 */ +/* 628 */ /***/ (function(module, exports, __webpack_require__) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -71336,7 +74109,7 @@ exports.SourceMapGenerator = SourceMapGenerator; * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -var base64 = __webpack_require__(616); +var base64 = __webpack_require__(629); // A single base 64 digit can contain 6 bits of data. For the base 64 variable // length quantities we use in the source map spec, the first bit is the sign, @@ -71442,7 +74215,7 @@ exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { /***/ }), -/* 616 */ +/* 629 */ /***/ (function(module, exports) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -71515,7 +74288,7 @@ exports.decode = function (charCode) { /***/ }), -/* 617 */ +/* 630 */ /***/ (function(module, exports) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -71938,7 +74711,7 @@ exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflate /***/ }), -/* 618 */ +/* 631 */ /***/ (function(module, exports, __webpack_require__) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -71948,7 +74721,7 @@ exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflate * http://opensource.org/licenses/BSD-3-Clause */ -var util = __webpack_require__(617); +var util = __webpack_require__(630); var has = Object.prototype.hasOwnProperty; var hasNativeMap = typeof Map !== "undefined"; @@ -72065,7 +74838,7 @@ exports.ArraySet = ArraySet; /***/ }), -/* 619 */ +/* 632 */ /***/ (function(module, exports, __webpack_require__) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -72075,7 +74848,7 @@ exports.ArraySet = ArraySet; * http://opensource.org/licenses/BSD-3-Clause */ -var util = __webpack_require__(617); +var util = __webpack_require__(630); /** * Determine whether mappingB is after mappingA with respect to generated @@ -72150,7 +74923,7 @@ exports.MappingList = MappingList; /***/ }), -/* 620 */ +/* 633 */ /***/ (function(module, exports, __webpack_require__) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -72160,11 +74933,11 @@ exports.MappingList = MappingList; * http://opensource.org/licenses/BSD-3-Clause */ -var util = __webpack_require__(617); -var binarySearch = __webpack_require__(621); -var ArraySet = __webpack_require__(618).ArraySet; -var base64VLQ = __webpack_require__(615); -var quickSort = __webpack_require__(622).quickSort; +var util = __webpack_require__(630); +var binarySearch = __webpack_require__(634); +var ArraySet = __webpack_require__(631).ArraySet; +var base64VLQ = __webpack_require__(628); +var quickSort = __webpack_require__(635).quickSort; function SourceMapConsumer(aSourceMap) { var sourceMap = aSourceMap; @@ -73238,7 +76011,7 @@ exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; /***/ }), -/* 621 */ +/* 634 */ /***/ (function(module, exports) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -73355,7 +76128,7 @@ exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { /***/ }), -/* 622 */ +/* 635 */ /***/ (function(module, exports) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -73475,7 +76248,7 @@ exports.quickSort = function (ary, comparator) { /***/ }), -/* 623 */ +/* 636 */ /***/ (function(module, exports, __webpack_require__) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -73485,8 +76258,8 @@ exports.quickSort = function (ary, comparator) { * http://opensource.org/licenses/BSD-3-Clause */ -var SourceMapGenerator = __webpack_require__(614).SourceMapGenerator; -var util = __webpack_require__(617); +var SourceMapGenerator = __webpack_require__(627).SourceMapGenerator; +var util = __webpack_require__(630); // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other // operating systems these days (capturing the result). @@ -73894,17 +76667,17 @@ exports.SourceNode = SourceNode; /***/ }), -/* 624 */ +/* 637 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2014, 2015, 2016, 2017 Simon Lydell // X11 (“MIT”) Licensed. (See LICENSE.) -var sourceMappingURL = __webpack_require__(625) -var resolveUrl = __webpack_require__(626) -var decodeUriComponent = __webpack_require__(627) -var urix = __webpack_require__(629) -var atob = __webpack_require__(630) +var sourceMappingURL = __webpack_require__(638) +var resolveUrl = __webpack_require__(639) +var decodeUriComponent = __webpack_require__(640) +var urix = __webpack_require__(642) +var atob = __webpack_require__(643) @@ -74202,7 +76975,7 @@ module.exports = { /***/ }), -/* 625 */ +/* 638 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;// Copyright 2014 Simon Lydell @@ -74265,13 +77038,13 @@ void (function(root, factory) { /***/ }), -/* 626 */ +/* 639 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2014 Simon Lydell // X11 (“MIT”) Licensed. (See LICENSE.) -var url = __webpack_require__(189) +var url = __webpack_require__(196) function resolveUrl(/* ...urls */) { return Array.prototype.reduce.call(arguments, function(resolved, nextUrl) { @@ -74283,13 +77056,13 @@ module.exports = resolveUrl /***/ }), -/* 627 */ +/* 640 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2017 Simon Lydell // X11 (“MIT”) Licensed. (See LICENSE.) -var decodeUriComponent = __webpack_require__(628) +var decodeUriComponent = __webpack_require__(641) function customDecodeUriComponent(string) { // `decodeUriComponent` turns `+` into ` `, but that's not wanted. @@ -74300,7 +77073,7 @@ module.exports = customDecodeUriComponent /***/ }), -/* 628 */ +/* 641 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74401,7 +77174,7 @@ module.exports = function (encodedURI) { /***/ }), -/* 629 */ +/* 642 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2014 Simon Lydell @@ -74424,7 +77197,7 @@ module.exports = urix /***/ }), -/* 630 */ +/* 643 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74438,16 +77211,16 @@ module.exports = atob.atob = atob; /***/ }), -/* 631 */ +/* 644 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var fs = __webpack_require__(132); +var fs = __webpack_require__(133); var path = __webpack_require__(4); -var define = __webpack_require__(593); -var utils = __webpack_require__(612); +var define = __webpack_require__(606); +var utils = __webpack_require__(625); /** * Expose `mixin()`. @@ -74590,19 +77363,19 @@ exports.comment = function(node) { /***/ }), -/* 632 */ +/* 645 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var use = __webpack_require__(604); +var use = __webpack_require__(617); var util = __webpack_require__(111); -var Cache = __webpack_require__(633); -var define = __webpack_require__(593); -var debug = __webpack_require__(606)('snapdragon:parser'); -var Position = __webpack_require__(634); -var utils = __webpack_require__(612); +var Cache = __webpack_require__(646); +var define = __webpack_require__(606); +var debug = __webpack_require__(619)('snapdragon:parser'); +var Position = __webpack_require__(647); +var utils = __webpack_require__(625); /** * Create a new `Parser` with the given `input` and `options`. @@ -75130,7 +77903,7 @@ module.exports = Parser; /***/ }), -/* 633 */ +/* 646 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75237,13 +78010,13 @@ MapCache.prototype.del = function mapDelete(key) { /***/ }), -/* 634 */ +/* 647 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var define = __webpack_require__(593); +var define = __webpack_require__(606); /** * Store position for a node @@ -75258,16 +78031,16 @@ module.exports = function Position(start, parser) { /***/ }), -/* 635 */ +/* 648 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var safe = __webpack_require__(636); -var define = __webpack_require__(642); -var extend = __webpack_require__(643); -var not = __webpack_require__(645); +var safe = __webpack_require__(649); +var define = __webpack_require__(655); +var extend = __webpack_require__(656); +var not = __webpack_require__(658); var MAX_LENGTH = 1024 * 64; /** @@ -75420,10 +78193,10 @@ module.exports.makeRe = makeRe; /***/ }), -/* 636 */ +/* 649 */ /***/ (function(module, exports, __webpack_require__) { -var parse = __webpack_require__(637); +var parse = __webpack_require__(650); var types = parse.types; module.exports = function (re, opts) { @@ -75469,13 +78242,13 @@ function isRegExp (x) { /***/ }), -/* 637 */ +/* 650 */ /***/ (function(module, exports, __webpack_require__) { -var util = __webpack_require__(638); -var types = __webpack_require__(639); -var sets = __webpack_require__(640); -var positions = __webpack_require__(641); +var util = __webpack_require__(651); +var types = __webpack_require__(652); +var sets = __webpack_require__(653); +var positions = __webpack_require__(654); module.exports = function(regexpStr) { @@ -75757,11 +78530,11 @@ module.exports.types = types; /***/ }), -/* 638 */ +/* 651 */ /***/ (function(module, exports, __webpack_require__) { -var types = __webpack_require__(639); -var sets = __webpack_require__(640); +var types = __webpack_require__(652); +var sets = __webpack_require__(653); // All of these are private and only used by randexp. @@ -75874,7 +78647,7 @@ exports.error = function(regexp, msg) { /***/ }), -/* 639 */ +/* 652 */ /***/ (function(module, exports) { module.exports = { @@ -75890,10 +78663,10 @@ module.exports = { /***/ }), -/* 640 */ +/* 653 */ /***/ (function(module, exports, __webpack_require__) { -var types = __webpack_require__(639); +var types = __webpack_require__(652); var INTS = function() { return [{ type: types.RANGE , from: 48, to: 57 }]; @@ -75978,10 +78751,10 @@ exports.anyChar = function() { /***/ }), -/* 641 */ +/* 654 */ /***/ (function(module, exports, __webpack_require__) { -var types = __webpack_require__(639); +var types = __webpack_require__(652); exports.wordBoundary = function() { return { type: types.POSITION, value: 'b' }; @@ -76001,7 +78774,7 @@ exports.end = function() { /***/ }), -/* 642 */ +/* 655 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76014,8 +78787,8 @@ exports.end = function() { -var isobject = __webpack_require__(544); -var isDescriptor = __webpack_require__(558); +var isobject = __webpack_require__(557); +var isDescriptor = __webpack_require__(571); var define = (typeof Reflect !== 'undefined' && Reflect.defineProperty) ? Reflect.defineProperty : Object.defineProperty; @@ -76046,14 +78819,14 @@ module.exports = function defineProperty(obj, key, val) { /***/ }), -/* 643 */ +/* 656 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isExtendable = __webpack_require__(644); -var assignSymbols = __webpack_require__(545); +var isExtendable = __webpack_require__(657); +var assignSymbols = __webpack_require__(558); module.exports = Object.assign || function(obj/*, objects*/) { if (obj === null || typeof obj === 'undefined') { @@ -76113,7 +78886,7 @@ function isEnum(obj, key) { /***/ }), -/* 644 */ +/* 657 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76126,7 +78899,7 @@ function isEnum(obj, key) { -var isPlainObject = __webpack_require__(543); +var isPlainObject = __webpack_require__(556); module.exports = function isExtendable(val) { return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); @@ -76134,14 +78907,14 @@ module.exports = function isExtendable(val) { /***/ }), -/* 645 */ +/* 658 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var extend = __webpack_require__(643); -var safe = __webpack_require__(636); +var extend = __webpack_require__(656); +var safe = __webpack_require__(649); /** * The main export is a function that takes a `pattern` string and an `options` object. @@ -76213,14 +78986,14 @@ module.exports = toRegex; /***/ }), -/* 646 */ +/* 659 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var nanomatch = __webpack_require__(647); -var extglob = __webpack_require__(663); +var nanomatch = __webpack_require__(660); +var extglob = __webpack_require__(676); module.exports = function(snapdragon) { var compilers = snapdragon.compiler.compilers; @@ -76297,7 +79070,7 @@ function escapeExtglobs(compiler) { /***/ }), -/* 647 */ +/* 660 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76308,17 +79081,17 @@ function escapeExtglobs(compiler) { */ var util = __webpack_require__(111); -var toRegex = __webpack_require__(648); -var extend = __webpack_require__(649); +var toRegex = __webpack_require__(661); +var extend = __webpack_require__(662); /** * Local dependencies */ -var compilers = __webpack_require__(651); -var parsers = __webpack_require__(652); -var cache = __webpack_require__(655); -var utils = __webpack_require__(657); +var compilers = __webpack_require__(664); +var parsers = __webpack_require__(665); +var cache = __webpack_require__(668); +var utils = __webpack_require__(670); var MAX_LENGTH = 1024 * 64; /** @@ -77142,15 +79915,15 @@ module.exports = nanomatch; /***/ }), -/* 648 */ +/* 661 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var define = __webpack_require__(593); -var extend = __webpack_require__(535); -var not = __webpack_require__(534); +var define = __webpack_require__(606); +var extend = __webpack_require__(548); +var not = __webpack_require__(547); var MAX_LENGTH = 1024 * 64; /** @@ -77297,14 +80070,14 @@ module.exports.makeRe = makeRe; /***/ }), -/* 649 */ +/* 662 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isExtendable = __webpack_require__(650); -var assignSymbols = __webpack_require__(545); +var isExtendable = __webpack_require__(663); +var assignSymbols = __webpack_require__(558); module.exports = Object.assign || function(obj/*, objects*/) { if (obj === null || typeof obj === 'undefined') { @@ -77364,7 +80137,7 @@ function isEnum(obj, key) { /***/ }), -/* 650 */ +/* 663 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77377,7 +80150,7 @@ function isEnum(obj, key) { -var isPlainObject = __webpack_require__(543); +var isPlainObject = __webpack_require__(556); module.exports = function isExtendable(val) { return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); @@ -77385,7 +80158,7 @@ module.exports = function isExtendable(val) { /***/ }), -/* 651 */ +/* 664 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77731,15 +80504,15 @@ module.exports = function(nanomatch, options) { /***/ }), -/* 652 */ +/* 665 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var regexNot = __webpack_require__(534); -var toRegex = __webpack_require__(648); -var isOdd = __webpack_require__(653); +var regexNot = __webpack_require__(547); +var toRegex = __webpack_require__(661); +var isOdd = __webpack_require__(666); /** * Characters to use in negation regex (we want to "not" match @@ -78125,7 +80898,7 @@ module.exports.not = NOT_REGEX; /***/ }), -/* 653 */ +/* 666 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78138,7 +80911,7 @@ module.exports.not = NOT_REGEX; -var isNumber = __webpack_require__(654); +var isNumber = __webpack_require__(667); module.exports = function isOdd(i) { if (!isNumber(i)) { @@ -78152,7 +80925,7 @@ module.exports = function isOdd(i) { /***/ }), -/* 654 */ +/* 667 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78180,14 +80953,14 @@ module.exports = function isNumber(num) { /***/ }), -/* 655 */ +/* 668 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = new (__webpack_require__(656))(); +module.exports = new (__webpack_require__(669))(); /***/ }), -/* 656 */ +/* 669 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78200,7 +80973,7 @@ module.exports = new (__webpack_require__(656))(); -var MapCache = __webpack_require__(633); +var MapCache = __webpack_require__(646); /** * Create a new `FragmentCache` with an optional object to use for `caches`. @@ -78322,7 +81095,7 @@ exports = module.exports = FragmentCache; /***/ }), -/* 657 */ +/* 670 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78335,14 +81108,14 @@ var path = __webpack_require__(4); * Module dependencies */ -var isWindows = __webpack_require__(658)(); -var Snapdragon = __webpack_require__(566); -utils.define = __webpack_require__(659); -utils.diff = __webpack_require__(660); -utils.extend = __webpack_require__(649); -utils.pick = __webpack_require__(661); -utils.typeOf = __webpack_require__(662); -utils.unique = __webpack_require__(537); +var isWindows = __webpack_require__(671)(); +var Snapdragon = __webpack_require__(579); +utils.define = __webpack_require__(672); +utils.diff = __webpack_require__(673); +utils.extend = __webpack_require__(662); +utils.pick = __webpack_require__(674); +utils.typeOf = __webpack_require__(675); +utils.unique = __webpack_require__(550); /** * Returns true if the given value is effectively an empty string @@ -78708,7 +81481,7 @@ utils.unixify = function(options) { /***/ }), -/* 658 */ +/* 671 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! @@ -78736,7 +81509,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ /***/ }), -/* 659 */ +/* 672 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78749,8 +81522,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ -var isobject = __webpack_require__(544); -var isDescriptor = __webpack_require__(558); +var isobject = __webpack_require__(557); +var isDescriptor = __webpack_require__(571); var define = (typeof Reflect !== 'undefined' && Reflect.defineProperty) ? Reflect.defineProperty : Object.defineProperty; @@ -78781,7 +81554,7 @@ module.exports = function defineProperty(obj, key, val) { /***/ }), -/* 660 */ +/* 673 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78835,7 +81608,7 @@ function diffArray(one, two) { /***/ }), -/* 661 */ +/* 674 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78848,7 +81621,7 @@ function diffArray(one, two) { -var isObject = __webpack_require__(544); +var isObject = __webpack_require__(557); module.exports = function pick(obj, keys) { if (!isObject(obj) && typeof obj !== 'function') { @@ -78877,7 +81650,7 @@ module.exports = function pick(obj, keys) { /***/ }), -/* 662 */ +/* 675 */ /***/ (function(module, exports) { var toString = Object.prototype.toString; @@ -79012,7 +81785,7 @@ function isBuffer(val) { /***/ }), -/* 663 */ +/* 676 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79022,18 +81795,18 @@ function isBuffer(val) { * Module dependencies */ -var extend = __webpack_require__(535); -var unique = __webpack_require__(537); -var toRegex = __webpack_require__(648); +var extend = __webpack_require__(548); +var unique = __webpack_require__(550); +var toRegex = __webpack_require__(661); /** * Local dependencies */ -var compilers = __webpack_require__(664); -var parsers = __webpack_require__(675); -var Extglob = __webpack_require__(678); -var utils = __webpack_require__(677); +var compilers = __webpack_require__(677); +var parsers = __webpack_require__(688); +var Extglob = __webpack_require__(691); +var utils = __webpack_require__(690); var MAX_LENGTH = 1024 * 64; /** @@ -79350,13 +82123,13 @@ module.exports = extglob; /***/ }), -/* 664 */ +/* 677 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var brackets = __webpack_require__(665); +var brackets = __webpack_require__(678); /** * Extglob compilers @@ -79526,7 +82299,7 @@ module.exports = function(extglob) { /***/ }), -/* 665 */ +/* 678 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79536,17 +82309,17 @@ module.exports = function(extglob) { * Local dependencies */ -var compilers = __webpack_require__(666); -var parsers = __webpack_require__(668); +var compilers = __webpack_require__(679); +var parsers = __webpack_require__(681); /** * Module dependencies */ -var debug = __webpack_require__(670)('expand-brackets'); -var extend = __webpack_require__(535); -var Snapdragon = __webpack_require__(566); -var toRegex = __webpack_require__(648); +var debug = __webpack_require__(683)('expand-brackets'); +var extend = __webpack_require__(548); +var Snapdragon = __webpack_require__(579); +var toRegex = __webpack_require__(661); /** * Parses the given POSIX character class `pattern` and returns a @@ -79744,13 +82517,13 @@ module.exports = brackets; /***/ }), -/* 666 */ +/* 679 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var posix = __webpack_require__(667); +var posix = __webpack_require__(680); module.exports = function(brackets) { brackets.compiler @@ -79838,7 +82611,7 @@ module.exports = function(brackets) { /***/ }), -/* 667 */ +/* 680 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79867,14 +82640,14 @@ module.exports = { /***/ }), -/* 668 */ +/* 681 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var utils = __webpack_require__(669); -var define = __webpack_require__(593); +var utils = __webpack_require__(682); +var define = __webpack_require__(606); /** * Text regex @@ -80093,14 +82866,14 @@ module.exports.TEXT_REGEX = TEXT_REGEX; /***/ }), -/* 669 */ +/* 682 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var toRegex = __webpack_require__(648); -var regexNot = __webpack_require__(534); +var toRegex = __webpack_require__(661); +var regexNot = __webpack_require__(547); var cached; /** @@ -80134,7 +82907,7 @@ exports.createRegex = function(pattern, include) { /***/ }), -/* 670 */ +/* 683 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -80143,14 +82916,14 @@ exports.createRegex = function(pattern, include) { */ if (typeof process !== 'undefined' && process.type === 'renderer') { - module.exports = __webpack_require__(671); + module.exports = __webpack_require__(684); } else { - module.exports = __webpack_require__(674); + module.exports = __webpack_require__(687); } /***/ }), -/* 671 */ +/* 684 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -80159,7 +82932,7 @@ if (typeof process !== 'undefined' && process.type === 'renderer') { * Expose `debug()` as the module. */ -exports = module.exports = __webpack_require__(672); +exports = module.exports = __webpack_require__(685); exports.log = log; exports.formatArgs = formatArgs; exports.save = save; @@ -80341,7 +83114,7 @@ function localstorage() { /***/ }), -/* 672 */ +/* 685 */ /***/ (function(module, exports, __webpack_require__) { @@ -80357,7 +83130,7 @@ exports.coerce = coerce; exports.disable = disable; exports.enable = enable; exports.enabled = enabled; -exports.humanize = __webpack_require__(673); +exports.humanize = __webpack_require__(686); /** * The currently active debug mode names, and names to skip. @@ -80549,7 +83322,7 @@ function coerce(val) { /***/ }), -/* 673 */ +/* 686 */ /***/ (function(module, exports) { /** @@ -80707,14 +83480,14 @@ function plural(ms, n, name) { /***/ }), -/* 674 */ +/* 687 */ /***/ (function(module, exports, __webpack_require__) { /** * Module dependencies. */ -var tty = __webpack_require__(278); +var tty = __webpack_require__(121); var util = __webpack_require__(111); /** @@ -80723,7 +83496,7 @@ var util = __webpack_require__(111); * Expose `debug()` as the module. */ -exports = module.exports = __webpack_require__(672); +exports = module.exports = __webpack_require__(685); exports.init = init; exports.log = log; exports.formatArgs = formatArgs; @@ -80895,14 +83668,14 @@ function createWritableStdioStream (fd) { break; case 'FILE': - var fs = __webpack_require__(132); + var fs = __webpack_require__(133); stream = new fs.SyncWriteStream(fd, { autoClose: false }); stream._type = 'fs'; break; case 'PIPE': case 'TCP': - var net = __webpack_require__(611); + var net = __webpack_require__(624); stream = new net.Socket({ fd: fd, readable: false, @@ -80961,15 +83734,15 @@ exports.enable(load()); /***/ }), -/* 675 */ +/* 688 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var brackets = __webpack_require__(665); -var define = __webpack_require__(676); -var utils = __webpack_require__(677); +var brackets = __webpack_require__(678); +var define = __webpack_require__(689); +var utils = __webpack_require__(690); /** * Characters to use in text regex (we want to "not" match @@ -81124,7 +83897,7 @@ module.exports = parsers; /***/ }), -/* 676 */ +/* 689 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -81137,7 +83910,7 @@ module.exports = parsers; -var isDescriptor = __webpack_require__(558); +var isDescriptor = __webpack_require__(571); module.exports = function defineProperty(obj, prop, val) { if (typeof obj !== 'object' && typeof obj !== 'function') { @@ -81162,14 +83935,14 @@ module.exports = function defineProperty(obj, prop, val) { /***/ }), -/* 677 */ +/* 690 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var regex = __webpack_require__(534); -var Cache = __webpack_require__(656); +var regex = __webpack_require__(547); +var Cache = __webpack_require__(669); /** * Utils @@ -81238,7 +84011,7 @@ utils.createRegex = function(str) { /***/ }), -/* 678 */ +/* 691 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -81248,16 +84021,16 @@ utils.createRegex = function(str) { * Module dependencies */ -var Snapdragon = __webpack_require__(566); -var define = __webpack_require__(676); -var extend = __webpack_require__(535); +var Snapdragon = __webpack_require__(579); +var define = __webpack_require__(689); +var extend = __webpack_require__(548); /** * Local dependencies */ -var compilers = __webpack_require__(664); -var parsers = __webpack_require__(675); +var compilers = __webpack_require__(677); +var parsers = __webpack_require__(688); /** * Customize Snapdragon parser and renderer @@ -81323,16 +84096,16 @@ module.exports = Extglob; /***/ }), -/* 679 */ +/* 692 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var extglob = __webpack_require__(663); -var nanomatch = __webpack_require__(647); -var regexNot = __webpack_require__(534); -var toRegex = __webpack_require__(635); +var extglob = __webpack_require__(676); +var nanomatch = __webpack_require__(660); +var regexNot = __webpack_require__(547); +var toRegex = __webpack_require__(648); var not; /** @@ -81413,14 +84186,14 @@ function textRegex(pattern) { /***/ }), -/* 680 */ +/* 693 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = new (__webpack_require__(656))(); +module.exports = new (__webpack_require__(669))(); /***/ }), -/* 681 */ +/* 694 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -81433,13 +84206,13 @@ var path = __webpack_require__(4); * Module dependencies */ -var Snapdragon = __webpack_require__(566); -utils.define = __webpack_require__(642); -utils.diff = __webpack_require__(660); -utils.extend = __webpack_require__(643); -utils.pick = __webpack_require__(661); -utils.typeOf = __webpack_require__(682); -utils.unique = __webpack_require__(537); +var Snapdragon = __webpack_require__(579); +utils.define = __webpack_require__(655); +utils.diff = __webpack_require__(673); +utils.extend = __webpack_require__(656); +utils.pick = __webpack_require__(674); +utils.typeOf = __webpack_require__(695); +utils.unique = __webpack_require__(550); /** * Returns true if the platform is windows, or `path.sep` is `\\`. @@ -81736,7 +84509,7 @@ utils.unixify = function(options) { /***/ }), -/* 682 */ +/* 695 */ /***/ (function(module, exports) { var toString = Object.prototype.toString; @@ -81871,7 +84644,7 @@ function isBuffer(val) { /***/ }), -/* 683 */ +/* 696 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -81890,9 +84663,9 @@ var __extends = (this && this.__extends) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -var readdir = __webpack_require__(684); -var reader_1 = __webpack_require__(697); -var fs_stream_1 = __webpack_require__(701); +var readdir = __webpack_require__(697); +var reader_1 = __webpack_require__(710); +var fs_stream_1 = __webpack_require__(714); var ReaderAsync = /** @class */ (function (_super) { __extends(ReaderAsync, _super); function ReaderAsync() { @@ -81953,15 +84726,15 @@ exports.default = ReaderAsync; /***/ }), -/* 684 */ +/* 697 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const readdirSync = __webpack_require__(685); -const readdirAsync = __webpack_require__(693); -const readdirStream = __webpack_require__(696); +const readdirSync = __webpack_require__(698); +const readdirAsync = __webpack_require__(706); +const readdirStream = __webpack_require__(709); module.exports = exports = readdirAsyncPath; exports.readdir = exports.readdirAsync = exports.async = readdirAsyncPath; @@ -82045,7 +84818,7 @@ function readdirStreamStat (dir, options) { /***/ }), -/* 685 */ +/* 698 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -82053,11 +84826,11 @@ function readdirStreamStat (dir, options) { module.exports = readdirSync; -const DirectoryReader = __webpack_require__(686); +const DirectoryReader = __webpack_require__(699); let syncFacade = { - fs: __webpack_require__(691), - forEach: __webpack_require__(692), + fs: __webpack_require__(704), + forEach: __webpack_require__(705), sync: true }; @@ -82086,18 +84859,18 @@ function readdirSync (dir, options, internalOptions) { /***/ }), -/* 686 */ +/* 699 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const Readable = __webpack_require__(136).Readable; -const EventEmitter = __webpack_require__(154).EventEmitter; +const Readable = __webpack_require__(137).Readable; +const EventEmitter = __webpack_require__(155).EventEmitter; const path = __webpack_require__(4); -const normalizeOptions = __webpack_require__(687); -const stat = __webpack_require__(689); -const call = __webpack_require__(690); +const normalizeOptions = __webpack_require__(700); +const stat = __webpack_require__(702); +const call = __webpack_require__(703); /** * Asynchronously reads the contents of a directory and streams the results @@ -82473,14 +85246,14 @@ module.exports = DirectoryReader; /***/ }), -/* 687 */ +/* 700 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(4); -const globToRegExp = __webpack_require__(688); +const globToRegExp = __webpack_require__(701); module.exports = normalizeOptions; @@ -82657,7 +85430,7 @@ function normalizeOptions (options, internalOptions) { /***/ }), -/* 688 */ +/* 701 */ /***/ (function(module, exports) { module.exports = function (glob, opts) { @@ -82794,13 +85567,13 @@ module.exports = function (glob, opts) { /***/ }), -/* 689 */ +/* 702 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const call = __webpack_require__(690); +const call = __webpack_require__(703); module.exports = stat; @@ -82875,7 +85648,7 @@ function symlinkStat (fs, path, lstats, callback) { /***/ }), -/* 690 */ +/* 703 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -82936,14 +85709,14 @@ function callOnce (fn) { /***/ }), -/* 691 */ +/* 704 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const fs = __webpack_require__(132); -const call = __webpack_require__(690); +const fs = __webpack_require__(133); +const call = __webpack_require__(703); /** * A facade around {@link fs.readdirSync} that allows it to be called @@ -83007,7 +85780,7 @@ exports.lstat = function (path, callback) { /***/ }), -/* 692 */ +/* 705 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83036,7 +85809,7 @@ function syncForEach (array, iterator, done) { /***/ }), -/* 693 */ +/* 706 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83044,12 +85817,12 @@ function syncForEach (array, iterator, done) { module.exports = readdirAsync; -const maybe = __webpack_require__(694); -const DirectoryReader = __webpack_require__(686); +const maybe = __webpack_require__(707); +const DirectoryReader = __webpack_require__(699); let asyncFacade = { - fs: __webpack_require__(132), - forEach: __webpack_require__(695), + fs: __webpack_require__(133), + forEach: __webpack_require__(708), async: true }; @@ -83091,7 +85864,7 @@ function readdirAsync (dir, options, callback, internalOptions) { /***/ }), -/* 694 */ +/* 707 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83118,7 +85891,7 @@ module.exports = function maybe (cb, promise) { /***/ }), -/* 695 */ +/* 708 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83154,7 +85927,7 @@ function asyncForEach (array, iterator, done) { /***/ }), -/* 696 */ +/* 709 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83162,11 +85935,11 @@ function asyncForEach (array, iterator, done) { module.exports = readdirStream; -const DirectoryReader = __webpack_require__(686); +const DirectoryReader = __webpack_require__(699); let streamFacade = { - fs: __webpack_require__(132), - forEach: __webpack_require__(695), + fs: __webpack_require__(133), + forEach: __webpack_require__(708), async: true }; @@ -83186,16 +85959,16 @@ function readdirStream (dir, options, internalOptions) { /***/ }), -/* 697 */ +/* 710 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var path = __webpack_require__(4); -var deep_1 = __webpack_require__(698); -var entry_1 = __webpack_require__(700); -var pathUtil = __webpack_require__(699); +var deep_1 = __webpack_require__(711); +var entry_1 = __webpack_require__(713); +var pathUtil = __webpack_require__(712); var Reader = /** @class */ (function () { function Reader(options) { this.options = options; @@ -83261,14 +86034,14 @@ exports.default = Reader; /***/ }), -/* 698 */ +/* 711 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var pathUtils = __webpack_require__(699); -var patternUtils = __webpack_require__(516); +var pathUtils = __webpack_require__(712); +var patternUtils = __webpack_require__(529); var DeepFilter = /** @class */ (function () { function DeepFilter(options, micromatchOptions) { this.options = options; @@ -83351,7 +86124,7 @@ exports.default = DeepFilter; /***/ }), -/* 699 */ +/* 712 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83382,14 +86155,14 @@ exports.makeAbsolute = makeAbsolute; /***/ }), -/* 700 */ +/* 713 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var pathUtils = __webpack_require__(699); -var patternUtils = __webpack_require__(516); +var pathUtils = __webpack_require__(712); +var patternUtils = __webpack_require__(529); var EntryFilter = /** @class */ (function () { function EntryFilter(options, micromatchOptions) { this.options = options; @@ -83474,7 +86247,7 @@ exports.default = EntryFilter; /***/ }), -/* 701 */ +/* 714 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83493,9 +86266,9 @@ var __extends = (this && this.__extends) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -var stream = __webpack_require__(136); -var fsStat = __webpack_require__(702); -var fs_1 = __webpack_require__(706); +var stream = __webpack_require__(137); +var fsStat = __webpack_require__(715); +var fs_1 = __webpack_require__(719); var FileSystemStream = /** @class */ (function (_super) { __extends(FileSystemStream, _super); function FileSystemStream() { @@ -83545,14 +86318,14 @@ exports.default = FileSystemStream; /***/ }), -/* 702 */ +/* 715 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const optionsManager = __webpack_require__(703); -const statProvider = __webpack_require__(705); +const optionsManager = __webpack_require__(716); +const statProvider = __webpack_require__(718); /** * Asynchronous API. */ @@ -83583,13 +86356,13 @@ exports.statSync = statSync; /***/ }), -/* 703 */ +/* 716 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fsAdapter = __webpack_require__(704); +const fsAdapter = __webpack_require__(717); function prepare(opts) { const options = Object.assign({ fs: fsAdapter.getFileSystemAdapter(opts ? opts.fs : undefined), @@ -83602,13 +86375,13 @@ exports.prepare = prepare; /***/ }), -/* 704 */ +/* 717 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fs = __webpack_require__(132); +const fs = __webpack_require__(133); exports.FILE_SYSTEM_ADAPTER = { lstat: fs.lstat, stat: fs.stat, @@ -83625,7 +86398,7 @@ exports.getFileSystemAdapter = getFileSystemAdapter; /***/ }), -/* 705 */ +/* 718 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83677,7 +86450,7 @@ exports.isFollowedSymlink = isFollowedSymlink; /***/ }), -/* 706 */ +/* 719 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83708,7 +86481,7 @@ exports.default = FileSystem; /***/ }), -/* 707 */ +/* 720 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83727,10 +86500,10 @@ var __extends = (this && this.__extends) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -var stream = __webpack_require__(136); -var readdir = __webpack_require__(684); -var reader_1 = __webpack_require__(697); -var fs_stream_1 = __webpack_require__(701); +var stream = __webpack_require__(137); +var readdir = __webpack_require__(697); +var reader_1 = __webpack_require__(710); +var fs_stream_1 = __webpack_require__(714); var TransformStream = /** @class */ (function (_super) { __extends(TransformStream, _super); function TransformStream(reader) { @@ -83798,7 +86571,7 @@ exports.default = ReaderStream; /***/ }), -/* 708 */ +/* 721 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83817,9 +86590,9 @@ var __extends = (this && this.__extends) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -var readdir = __webpack_require__(684); -var reader_1 = __webpack_require__(697); -var fs_sync_1 = __webpack_require__(709); +var readdir = __webpack_require__(697); +var reader_1 = __webpack_require__(710); +var fs_sync_1 = __webpack_require__(722); var ReaderSync = /** @class */ (function (_super) { __extends(ReaderSync, _super); function ReaderSync() { @@ -83879,7 +86652,7 @@ exports.default = ReaderSync; /***/ }), -/* 709 */ +/* 722 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83898,8 +86671,8 @@ var __extends = (this && this.__extends) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -var fsStat = __webpack_require__(702); -var fs_1 = __webpack_require__(706); +var fsStat = __webpack_require__(715); +var fs_1 = __webpack_require__(719); var FileSystemSync = /** @class */ (function (_super) { __extends(FileSystemSync, _super); function FileSystemSync() { @@ -83945,7 +86718,7 @@ exports.default = FileSystemSync; /***/ }), -/* 710 */ +/* 723 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83961,13 +86734,13 @@ exports.flatten = flatten; /***/ }), -/* 711 */ +/* 724 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var merge2 = __webpack_require__(284); +var merge2 = __webpack_require__(299); /** * Merge multiple streams and propagate their errors into one stream in parallel. */ @@ -83982,13 +86755,13 @@ exports.merge = merge; /***/ }), -/* 712 */ +/* 725 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(4); -const pathType = __webpack_require__(713); +const pathType = __webpack_require__(726); const getExtensions = extensions => extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0]; @@ -84054,13 +86827,13 @@ module.exports.sync = (input, opts) => { /***/ }), -/* 713 */ +/* 726 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const fs = __webpack_require__(132); -const pify = __webpack_require__(714); +const fs = __webpack_require__(133); +const pify = __webpack_require__(727); function type(fn, fn2, fp) { if (typeof fp !== 'string') { @@ -84103,7 +86876,7 @@ exports.symlinkSync = typeSync.bind(null, 'lstatSync', 'isSymbolicLink'); /***/ }), -/* 714 */ +/* 727 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -84194,17 +86967,17 @@ module.exports = (obj, opts) => { /***/ }), -/* 715 */ +/* 728 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const fs = __webpack_require__(132); +const fs = __webpack_require__(133); const path = __webpack_require__(4); -const fastGlob = __webpack_require__(512); -const gitIgnore = __webpack_require__(716); -const pify = __webpack_require__(717); -const slash = __webpack_require__(718); +const fastGlob = __webpack_require__(525); +const gitIgnore = __webpack_require__(729); +const pify = __webpack_require__(730); +const slash = __webpack_require__(731); const DEFAULT_IGNORE = [ '**/node_modules/**', @@ -84302,7 +87075,7 @@ module.exports.sync = options => { /***/ }), -/* 716 */ +/* 729 */ /***/ (function(module, exports) { // A simple implementation of make-array @@ -84771,7 +87544,7 @@ module.exports = options => new IgnoreBase(options) /***/ }), -/* 717 */ +/* 730 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -84846,7 +87619,7 @@ module.exports = (input, options) => { /***/ }), -/* 718 */ +/* 731 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -84864,7 +87637,7 @@ module.exports = input => { /***/ }), -/* 719 */ +/* 732 */ /***/ (function(module, exports, __webpack_require__) { /*! @@ -84874,7 +87647,7 @@ module.exports = input => { * Released under the MIT License. */ -var isExtglob = __webpack_require__(300); +var isExtglob = __webpack_require__(315); var chars = { '{': '}', '(': ')', '[': ']'}; var strictRegex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; var relaxedRegex = /\\(.)|(^!|[*?{}()[\]]|\(\?)/; @@ -84918,17 +87691,17 @@ module.exports = function isGlob(str, options) { /***/ }), -/* 720 */ +/* 733 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(4); -const {constants: fsConstants} = __webpack_require__(132); -const pEvent = __webpack_require__(721); -const CpFileError = __webpack_require__(724); -const fs = __webpack_require__(728); -const ProgressEmitter = __webpack_require__(731); +const {constants: fsConstants} = __webpack_require__(133); +const pEvent = __webpack_require__(734); +const CpFileError = __webpack_require__(737); +const fs = __webpack_require__(741); +const ProgressEmitter = __webpack_require__(744); const cpFileAsync = async (source, destination, options, progressEmitter) => { let readError; @@ -85042,12 +87815,12 @@ module.exports.sync = (source, destination, options) => { /***/ }), -/* 721 */ +/* 734 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const pTimeout = __webpack_require__(722); +const pTimeout = __webpack_require__(735); const symbolAsyncIterator = Symbol.asyncIterator || '@@asyncIterator'; @@ -85338,12 +88111,12 @@ module.exports.iterator = (emitter, event, options) => { /***/ }), -/* 722 */ +/* 735 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const pFinally = __webpack_require__(723); +const pFinally = __webpack_require__(736); class TimeoutError extends Error { constructor(message) { @@ -85389,7 +88162,7 @@ module.exports.TimeoutError = TimeoutError; /***/ }), -/* 723 */ +/* 736 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -85411,12 +88184,12 @@ module.exports = (promise, onFinally) => { /***/ }), -/* 724 */ +/* 737 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const NestedError = __webpack_require__(725); +const NestedError = __webpack_require__(738); class CpFileError extends NestedError { constructor(message, nested) { @@ -85430,10 +88203,10 @@ module.exports = CpFileError; /***/ }), -/* 725 */ +/* 738 */ /***/ (function(module, exports, __webpack_require__) { -var inherits = __webpack_require__(726); +var inherits = __webpack_require__(739); var NestedError = function (message, nested) { this.nested = nested; @@ -85484,7 +88257,7 @@ module.exports = NestedError; /***/ }), -/* 726 */ +/* 739 */ /***/ (function(module, exports, __webpack_require__) { try { @@ -85492,12 +88265,12 @@ try { if (typeof util.inherits !== 'function') throw ''; module.exports = util.inherits; } catch (e) { - module.exports = __webpack_require__(727); + module.exports = __webpack_require__(740); } /***/ }), -/* 727 */ +/* 740 */ /***/ (function(module, exports) { if (typeof Object.create === 'function') { @@ -85526,16 +88299,16 @@ if (typeof Object.create === 'function') { /***/ }), -/* 728 */ +/* 741 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const {promisify} = __webpack_require__(111); -const fs = __webpack_require__(131); -const makeDir = __webpack_require__(729); -const pEvent = __webpack_require__(721); -const CpFileError = __webpack_require__(724); +const fs = __webpack_require__(132); +const makeDir = __webpack_require__(742); +const pEvent = __webpack_require__(734); +const CpFileError = __webpack_require__(737); const stat = promisify(fs.stat); const lstat = promisify(fs.lstat); @@ -85632,15 +88405,15 @@ exports.copyFileSync = (source, destination, flags) => { /***/ }), -/* 729 */ +/* 742 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const fs = __webpack_require__(132); +const fs = __webpack_require__(133); const path = __webpack_require__(4); const {promisify} = __webpack_require__(111); -const semver = __webpack_require__(730); +const semver = __webpack_require__(743); const useNativeRecursiveOption = semver.satisfies(process.version, '>=10.12.0'); @@ -85795,7 +88568,7 @@ module.exports.sync = (input, options) => { /***/ }), -/* 730 */ +/* 743 */ /***/ (function(module, exports) { exports = module.exports = SemVer @@ -87397,12 +90170,12 @@ function coerce (version, options) { /***/ }), -/* 731 */ +/* 744 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const EventEmitter = __webpack_require__(154); +const EventEmitter = __webpack_require__(155); const written = new WeakMap(); @@ -87438,7 +90211,7 @@ module.exports = ProgressEmitter; /***/ }), -/* 732 */ +/* 745 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -87484,12 +90257,12 @@ exports.default = module.exports; /***/ }), -/* 733 */ +/* 746 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const NestedError = __webpack_require__(734); +const NestedError = __webpack_require__(747); class CpyError extends NestedError { constructor(message, nested) { @@ -87503,7 +90276,7 @@ module.exports = CpyError; /***/ }), -/* 734 */ +/* 747 */ /***/ (function(module, exports, __webpack_require__) { var inherits = __webpack_require__(111).inherits; @@ -87559,14 +90332,14 @@ module.exports = NestedError; /***/ }), -/* 735 */ +/* 748 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "prepareExternalProjectDependencies", function() { return prepareExternalProjectDependencies; }); -/* harmony import */ var _utils_package_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(163); -/* harmony import */ var _utils_project__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(162); +/* harmony import */ var _utils_package_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(164); +/* harmony import */ var _utils_project__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(163); /* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with diff --git a/packages/kbn-pm/package.json b/packages/kbn-pm/package.json index 3e40bf40222e65..78fa48979c1b57 100644 --- a/packages/kbn-pm/package.json +++ b/packages/kbn-pm/package.json @@ -35,7 +35,7 @@ "@kbn/dev-utils": "1.0.0", "@yarnpkg/lockfile": "^1.1.0", "babel-loader": "^8.0.6", - "chalk": "^2.4.2", + "chalk": "^4.1.0", "cmd-shim": "^2.1.0", "cpy": "^8.0.0", "dedent": "^0.7.0", diff --git a/packages/kbn-test/package.json b/packages/kbn-test/package.json index 9482ea83cc257b..f86bcfd2bb7b28 100644 --- a/packages/kbn-test/package.json +++ b/packages/kbn-test/package.json @@ -21,7 +21,7 @@ "diff": "^4.0.1" }, "dependencies": { - "chalk": "^2.4.2", + "chalk": "^4.1.0", "dedent": "^0.7.0", "del": "^5.1.0", "exit-hook": "^2.2.0", diff --git a/packages/kbn-ui-framework/package.json b/packages/kbn-ui-framework/package.json index a095d9ac2a77f1..a2151ca3381bc3 100644 --- a/packages/kbn-ui-framework/package.json +++ b/packages/kbn-ui-framework/package.json @@ -36,7 +36,7 @@ "@kbn/optimizer": "1.0.0", "babel-loader": "^8.0.6", "brace": "0.11.1", - "chalk": "^2.4.2", + "chalk": "^4.1.0", "chokidar": "3.2.1", "core-js": "^3.6.4", "css-loader": "^3.4.2", diff --git a/rfcs/text/0001_lifecycle_setup.md b/rfcs/text/0001_lifecycle_setup.md index 01343b42f9a2dc..bff200ca764728 100644 --- a/rfcs/text/0001_lifecycle_setup.md +++ b/rfcs/text/0001_lifecycle_setup.md @@ -124,7 +124,7 @@ all services and plugins, and then adding an empty `start` where it is necessary. Functionality can then be moved from `setup`->`start` on a case-by-case. -If this change doesn't happen for awhile, then it might make sense to follow +If this change doesn't happen for a while, then it might make sense to follow the reverse process to ensure the least impact. The migration guide will be updated to reflect the `setup` and `start` diff --git a/src/dev/typescript/exec_in_projects.ts b/src/dev/typescript/exec_in_projects.ts index 5197aa67c7268a..92f71b9bb864ad 100644 --- a/src/dev/typescript/exec_in_projects.ts +++ b/src/dev/typescript/exec_in_projects.ts @@ -43,7 +43,7 @@ export function execInProjects( // execute in the current working directory so that relative paths in errors // are relative from the right location cwd: process.cwd(), - env: chalk.enabled ? { FORCE_COLOR: 'true' } : {}, + env: chalk.level > 0 ? { FORCE_COLOR: 'true' } : {}, stdio: ['ignore', 'pipe', 'pipe'], preferLocal: true, }).catch((error) => { diff --git a/src/plugins/data/common/es_query/filters/exists_filter.test.ts b/src/plugins/data/common/es_query/filters/exists_filter.test.ts index 065301986726d0..298ea7f49da5e5 100644 --- a/src/plugins/data/common/es_query/filters/exists_filter.test.ts +++ b/src/plugins/data/common/es_query/filters/exists_filter.test.ts @@ -19,7 +19,7 @@ import { buildExistsFilter, getExistsFilterField } from './exists_filter'; import { IIndexPattern } from '../../index_patterns'; -import { fields } from '../../index_patterns/fields/fields.mocks.ts'; +import { fields } from '../../index_patterns/fields/fields.mocks'; describe('exists filter', function () { const indexPattern: IIndexPattern = ({ diff --git a/src/plugins/data/common/es_query/filters/get_filter_field.test.ts b/src/plugins/data/common/es_query/filters/get_filter_field.test.ts index 4329a45f84ef97..3b27aa98cf5f62 100644 --- a/src/plugins/data/common/es_query/filters/get_filter_field.test.ts +++ b/src/plugins/data/common/es_query/filters/get_filter_field.test.ts @@ -21,7 +21,7 @@ import { buildPhraseFilter } from './phrase_filter'; import { buildQueryFilter } from './query_string_filter'; import { getFilterField } from './get_filter_field'; import { IIndexPattern } from '../../index_patterns'; -import { fields } from '../../index_patterns/fields/fields.mocks.ts'; +import { fields } from '../../index_patterns/fields/fields.mocks'; describe('getFilterField', function () { const indexPattern: IIndexPattern = ({ diff --git a/src/plugins/data/common/es_query/filters/phrases_filter.test.ts b/src/plugins/data/common/es_query/filters/phrases_filter.test.ts index 7fbab263ac0403..ed42b63be7eccd 100644 --- a/src/plugins/data/common/es_query/filters/phrases_filter.test.ts +++ b/src/plugins/data/common/es_query/filters/phrases_filter.test.ts @@ -19,7 +19,7 @@ import { buildPhrasesFilter, getPhrasesFilterField } from './phrases_filter'; import { IIndexPattern } from '../../index_patterns'; -import { fields } from '../../index_patterns/fields/fields.mocks.ts'; +import { fields } from '../../index_patterns/fields/fields.mocks'; describe('phrases filter', function () { const indexPattern: IIndexPattern = ({ diff --git a/src/plugins/data/common/index_patterns/fields/field_list.ts b/src/plugins/data/common/index_patterns/fields/field_list.ts index 207002f42bbce5..172da9f9ca43f2 100644 --- a/src/plugins/data/common/index_patterns/fields/field_list.ts +++ b/src/plugins/data/common/index_patterns/fields/field_list.ts @@ -27,6 +27,7 @@ type FieldMap = Map; export interface IIndexPatternFieldList extends Array { add(field: FieldSpec): void; + getAll(): IndexPatternField[]; getByName(name: IndexPatternField['name']): IndexPatternField | undefined; getByType(type: IndexPatternField['type']): IndexPatternField[]; remove(field: IFieldType): void; @@ -72,6 +73,7 @@ export class FieldList extends Array implements IIndexPattern specs.map((field) => this.add(field)); } + public readonly getAll = () => [...this.byName.values()]; public readonly getByName = (name: IndexPatternField['name']) => this.byName.get(name); public readonly getByType = (type: IndexPatternField['type']) => [ ...(this.groups.get(type) || new Map()).values(), diff --git a/src/plugins/data/common/index_patterns/fields/fields.mocks.ts.ts b/src/plugins/data/common/index_patterns/fields/fields.mocks.ts similarity index 100% rename from src/plugins/data/common/index_patterns/fields/fields.mocks.ts.ts rename to src/plugins/data/common/index_patterns/fields/fields.mocks.ts diff --git a/src/plugins/data/common/index_patterns/fields/index_pattern_field.ts b/src/plugins/data/common/index_patterns/fields/index_pattern_field.ts index 4e22332bef141e..679de103f8019d 100644 --- a/src/plugins/data/common/index_patterns/fields/index_pattern_field.ts +++ b/src/plugins/data/common/index_patterns/fields/index_pattern_field.ts @@ -62,7 +62,7 @@ export class IndexPatternField implements IFieldType { // writable attrs public get count() { - return this.spec.count; + return this.spec.count || 0; } public set count(count) { @@ -107,7 +107,7 @@ export class IndexPatternField implements IFieldType { } public get scripted() { - return this.spec.scripted; + return !!this.spec.scripted; } public get searchable() { diff --git a/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts b/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts index 211919e8e6b530..4e484dce7826f0 100644 --- a/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts +++ b/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts @@ -403,11 +403,11 @@ export class IndexPattern implements IIndexPattern { } getNonScriptedFields() { - return [...this.fields.filter((field) => !field.scripted)]; + return [...this.fields.getAll().filter((field) => !field.scripted)]; } getScriptedFields() { - return [...this.fields.filter((field) => field.scripted)]; + return [...this.fields.getAll().filter((field) => field.scripted)]; } isTimeBased(): boolean { diff --git a/src/plugins/data/common/index_patterns/mocks.ts b/src/plugins/data/common/index_patterns/mocks.ts index 6036c08fa2b107..faf1b8307ea2ea 100644 --- a/src/plugins/data/common/index_patterns/mocks.ts +++ b/src/plugins/data/common/index_patterns/mocks.ts @@ -17,4 +17,4 @@ * under the License. */ -export * from './fields/fields.mocks.ts'; +export * from './fields/fields.mocks'; diff --git a/src/plugins/data/common/index_patterns/types.ts b/src/plugins/data/common/index_patterns/types.ts index 3a7cf54843dfcc..a771113acd2310 100644 --- a/src/plugins/data/common/index_patterns/types.ts +++ b/src/plugins/data/common/index_patterns/types.ts @@ -149,7 +149,7 @@ export interface FieldSpecExportFmt { } export interface FieldSpec { - count: number; + count?: number; script?: string; lang?: string; conflictDescriptions?: Record; @@ -158,7 +158,7 @@ export interface FieldSpec { name: string; type: string; esTypes?: string[]; - scripted: boolean; + scripted?: boolean; searchable: boolean; aggregatable: boolean; readFromDocValues?: boolean; diff --git a/src/plugins/data/common/search/es_search/types.ts b/src/plugins/data/common/search/es_search/types.ts index db2e31706e95ce..6fc09237687037 100644 --- a/src/plugins/data/common/search/es_search/types.ts +++ b/src/plugins/data/common/search/es_search/types.ts @@ -31,5 +31,13 @@ export interface IEsSearchRequest extends IKibanaSearchRequest { } export interface IEsSearchResponse extends IKibanaSearchResponse { + /** + * Indicates whether async search is still in flight + */ + isRunning?: boolean; + /** + * Indicates whether the results returned are complete or partial + */ + isPartial?: boolean; rawResponse: SearchResponse; } diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index 5a9930d2b6b56f..f036d5f30a0e25 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -337,7 +337,6 @@ export { // search ES_SEARCH_STRATEGY, getEsPreference, - getSearchErrorType, ISearch, ISearchOptions, ISearchGeneric, diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index 76f88df4dd6fcd..6225d74fb1b310 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -585,6 +585,8 @@ export class FieldList extends Array implements IIndexPattern // (undocumented) readonly add: (field: FieldSpec) => void; // (undocumented) + readonly getAll: () => IndexPatternField[]; + // (undocumented) readonly getByName: (name: IndexPatternField['name']) => IndexPatternField | undefined; // (undocumented) readonly getByType: (type: IndexPatternField['type']) => any[]; @@ -701,11 +703,6 @@ export function getEsPreference(uiSettings: IUiSettingsClient_2, sessionId?: str // @public export const getKbnTypeNames: () => string[]; -// Warning: (ae-missing-release-tag) "getSearchErrorType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export function getSearchErrorType({ message }: Pick): "UNSUPPORTED_QUERY" | undefined; - // Warning: (ae-forgotten-export) The symbol "ISearchRequestParams" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "getSearchParamsFromRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -773,6 +770,8 @@ export interface IEsSearchRequest extends IKibanaSearchRequest { // // @public (undocumented) export interface IEsSearchResponse extends IKibanaSearchResponse { + isPartial?: boolean; + isRunning?: boolean; // (undocumented) rawResponse: SearchResponse_2; } @@ -879,6 +878,8 @@ export interface IIndexPatternFieldList extends Array { // (undocumented) add(field: FieldSpec): void; // (undocumented) + getAll(): IndexPatternField[]; + // (undocumented) getByName(name: IndexPatternField['name']): IndexPatternField | undefined; // (undocumented) getByType(type: IndexPatternField['type']): IndexPatternField[]; @@ -1214,11 +1215,10 @@ export type InputTimeRange = TimeRange | { // @public (undocumented) export type ISearch = (request: IKibanaSearchRequest, options?: ISearchOptions) => Observable; -// Warning: (ae-forgotten-export) The symbol "IStrategyOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "ISearchGeneric" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export type ISearchGeneric = (request: IEsSearchRequest, options?: IStrategyOptions) => Observable; +export type ISearchGeneric = (request: IEsSearchRequest, options?: ISearchOptions) => Observable; // Warning: (ae-missing-release-tag) "ISearchOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1226,6 +1226,8 @@ export type ISearchGeneric = (request: IEsSearchRequest, options?: IStrategyOpti export interface ISearchOptions { // (undocumented) signal?: AbortSignal; + // (undocumented) + strategy?: string; } // Warning: (ae-forgotten-export) The symbol "SearchSource" needs to be exported by the entry point index.d.ts @@ -1692,9 +1694,7 @@ export type SearchBarProps = SearchBarOwnProps & SearchBarInjectedDeps; // Warning: (ae-missing-release-tag) "SearchError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export class SearchError extends Error { - // Warning: (ae-forgotten-export) The symbol "SearchErrorOptions" needs to be exported by the entry point index.d.ts - constructor({ status, title, message, path, type }: SearchErrorOptions); +export interface SearchError { // (undocumented) message: string; // (undocumented) @@ -1726,7 +1726,7 @@ export class SearchInterceptor { // (undocumented) protected readonly requestTimeout?: number | undefined; // (undocumented) - protected runSearch(request: IEsSearchRequest, signal: AbortSignal): Observable; + protected runSearch(request: IEsSearchRequest, signal: AbortSignal, strategy?: string): Observable; search(request: IEsSearchRequest, options?: ISearchOptions): Observable; // (undocumented) protected setupTimers(options?: ISearchOptions): { @@ -1964,21 +1964,21 @@ export const UI_SETTINGS: { // src/plugins/data/public/index.ts:234:27 - (ae-forgotten-export) The symbol "getFromSavedObject" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:234:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:234:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:370:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:370:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:370:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:370:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:372:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:373:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:382:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:383:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:384:1 - (ae-forgotten-export) The symbol "Ipv4Address" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:385:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:389:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:390:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:393:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:394:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:397:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:369:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:369:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:369:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:369:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:371:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:372:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:381:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:382:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:383:1 - (ae-forgotten-export) The symbol "Ipv4Address" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:384:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:388:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:389:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:392:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:393:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:396:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts // src/plugins/data/public/query/state_sync/connect_to_query_state.ts:45:5 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts // src/plugins/data/public/types.ts:54:5 - (ae-forgotten-export) The symbol "createFiltersFromValueClickAction" needs to be exported by the entry point index.d.ts // src/plugins/data/public/types.ts:55:5 - (ae-forgotten-export) The symbol "createFiltersFromRangeSelectAction" needs to be exported by the entry point index.d.ts diff --git a/src/plugins/data/public/query/mocks.ts b/src/plugins/data/public/query/mocks.ts index 8c15d9d6d0152e..53c177de0fa394 100644 --- a/src/plugins/data/public/query/mocks.ts +++ b/src/plugins/data/public/query/mocks.ts @@ -44,6 +44,7 @@ const createStartContractMock = () => { savedQueries: jest.fn() as any, state$: new Observable(), timefilter: timefilterServiceMock.createStartContract(), + getEsQuery: jest.fn(), }; return startContract; diff --git a/src/plugins/data/public/query/query_service.ts b/src/plugins/data/public/query/query_service.ts index da514c0e24ea44..fe7fdcbb1d113c 100644 --- a/src/plugins/data/public/query/query_service.ts +++ b/src/plugins/data/public/query/query_service.ts @@ -26,6 +26,9 @@ import { TimefilterService, TimefilterSetup } from './timefilter'; import { createSavedQueryService } from './saved_query/saved_query_service'; import { createQueryStateObservable } from './state_sync/create_global_query_observable'; import { QueryStringManager, QueryStringContract } from './query_string'; +import { buildEsQuery, getEsQueryConfig } from '../../common'; +import { getUiSettings } from '../services'; +import { IndexPattern } from '..'; /** * Query Service @@ -86,6 +89,16 @@ export class QueryService { savedQueries: createSavedQueryService(savedObjectsClient), state$: this.state$, timefilter: this.timefilter, + getEsQuery: (indexPattern: IndexPattern) => { + const timeFilter = this.timefilter.timefilter.createFilter(indexPattern); + + return buildEsQuery( + indexPattern, + this.queryStringManager.getQuery(), + [...this.filterManager.getFilters(), ...(timeFilter ? [timeFilter] : [])], + getEsQueryConfig(getUiSettings()) + ); + }, }; } diff --git a/src/plugins/data/public/search/fetch/index.ts b/src/plugins/data/public/search/fetch/index.ts index ab856d681ba125..79cdad1897f9c3 100644 --- a/src/plugins/data/public/search/fetch/index.ts +++ b/src/plugins/data/public/search/fetch/index.ts @@ -27,6 +27,5 @@ export { getMaxConcurrentShardRequests, } from './get_search_params'; -export { SearchError, getSearchErrorType } from './search_error'; export { RequestFailure } from './request_error'; export { handleResponse } from './handle_response'; diff --git a/src/plugins/data/public/search/fetch/request_error.ts b/src/plugins/data/public/search/fetch/request_error.ts index e216d32e127cd4..5e42a6fcf5b655 100644 --- a/src/plugins/data/public/search/fetch/request_error.ts +++ b/src/plugins/data/public/search/fetch/request_error.ts @@ -17,8 +17,8 @@ * under the License. */ -import { KbnError } from '../../../../kibana_utils/public'; -import { SearchResponse, SearchError } from '..'; +import { KbnError } from '../../../../kibana_utils/common'; +import { SearchError, SearchResponse } from './types'; /** * Request Failure - When an entire multi request fails diff --git a/src/plugins/data/public/search/fetch/search_error.ts b/src/plugins/data/public/search/fetch/search_error.ts deleted file mode 100644 index d4042fb17499cb..00000000000000 --- a/src/plugins/data/public/search/fetch/search_error.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -interface SearchErrorOptions { - status: string; - title: string; - message: string; - path: string; - type: string; -} - -export class SearchError extends Error { - public name: string; - public status: string; - public title: string; - public message: string; - public path: string; - public type: string; - - constructor({ status, title, message, path, type }: SearchErrorOptions) { - super(message); - this.name = 'SearchError'; - this.status = status; - this.title = title; - this.message = message; - this.path = path; - this.type = type; - - // captureStackTrace is only available in the V8 engine, so any browser using - // a different JS engine won't have access to this method. - if (Error.captureStackTrace) { - Error.captureStackTrace(this, SearchError); - } - - // Babel doesn't support traditional `extends` syntax for built-in classes. - // https://babeljs.io/docs/en/caveats/#classes - Object.setPrototypeOf(this, SearchError.prototype); - } -} - -export function getSearchErrorType({ message }: Pick) { - const msg = message.toLowerCase(); - if (msg.indexOf('unsupported query') > -1) { - return 'UNSUPPORTED_QUERY'; - } -} diff --git a/src/plugins/data/public/search/fetch/types.ts b/src/plugins/data/public/search/fetch/types.ts index 1aba4f66bb4d77..dda66d6b5238d2 100644 --- a/src/plugins/data/public/search/fetch/types.ts +++ b/src/plugins/data/public/search/fetch/types.ts @@ -33,3 +33,12 @@ export interface FetchHandlers { config: IUiSettingsClient; esShardTimeout: number; } + +export interface SearchError { + name: string; + status: string; + title: string; + message: string; + path: string; + type: string; +} diff --git a/src/plugins/data/public/search/index.ts b/src/plugins/data/public/search/index.ts index 40d45ab88ea9f9..96445e5367147d 100644 --- a/src/plugins/data/public/search/index.ts +++ b/src/plugins/data/public/search/index.ts @@ -34,7 +34,6 @@ export { FetchOptions, SearchRequest, SearchResponse, - getSearchErrorType, getSearchParamsFromRequest, } from './fetch'; diff --git a/src/plugins/data/public/search/search_interceptor.ts b/src/plugins/data/public/search/search_interceptor.ts index e6eca16c5ca4bc..d6fcde8e986f36 100644 --- a/src/plugins/data/public/search/search_interceptor.ts +++ b/src/plugins/data/public/search/search_interceptor.ts @@ -17,11 +17,12 @@ * under the License. */ +import { trimEnd } from 'lodash'; import { BehaviorSubject, throwError, timer, Subscription, defer, from, Observable } from 'rxjs'; import { finalize, filter } from 'rxjs/operators'; import { ApplicationStart, Toast, ToastsStart, CoreStart } from 'kibana/public'; import { getCombinedSignal, AbortError } from '../../common/utils'; -import { IEsSearchRequest, IEsSearchResponse } from '../../common/search'; +import { IEsSearchRequest, IEsSearchResponse, ES_SEARCH_STRATEGY } from '../../common/search'; import { ISearchOptions } from './types'; import { getLongQueryNotification } from './long_query_notification'; import { SearchUsageCollector } from './collectors'; @@ -92,14 +93,20 @@ export class SearchInterceptor { protected runSearch( request: IEsSearchRequest, - signal: AbortSignal + signal: AbortSignal, + strategy?: string ): Observable { const { id, ...searchRequest } = request; - const path = id != null ? `/internal/search/es/${id}` : '/internal/search/es'; - const method = 'POST'; + const path = trimEnd(`/internal/search/${strategy || ES_SEARCH_STRATEGY}/${id || ''}`, '/'); const body = JSON.stringify(id != null ? {} : searchRequest); - const response = this.deps.http.fetch({ path, method, body, signal }); - return from(response); + return from( + this.deps.http.fetch({ + method: 'POST', + path, + body, + signal, + }) + ); } /** @@ -120,7 +127,7 @@ export class SearchInterceptor { const { combinedSignal, cleanup } = this.setupTimers(options); this.pendingCount$.next(++this.pendingCount); - return this.runSearch(request, combinedSignal).pipe( + return this.runSearch(request, combinedSignal, options?.strategy).pipe( finalize(() => { this.pendingCount$.next(--this.pendingCount); cleanup(); @@ -170,7 +177,7 @@ export class SearchInterceptor { if (this.longRunningToast) return; this.longRunningToast = this.deps.toasts.addInfo( { - title: 'Your query is taking awhile', + title: 'Your query is taking a while', text: getLongQueryNotification({ application: this.deps.application, }), diff --git a/src/plugins/data/public/search/search_source/create_search_source.ts b/src/plugins/data/public/search/search_source/create_search_source.ts index 3466d60e5dd7e2..4c44f4d62d469d 100644 --- a/src/plugins/data/public/search/search_source/create_search_source.ts +++ b/src/plugins/data/public/search/search_source/create_search_source.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { migrateLegacyQuery } from '../../../../kibana_legacy/public'; +import { migrateLegacyQuery } from '../../../../kibana_legacy/common'; import { SearchSource, SearchSourceDependencies } from './search_source'; import { IndexPatternsContract } from '../../index_patterns/index_patterns'; import { SearchSourceFields } from './types'; diff --git a/src/plugins/data/public/search/search_source/parse_json.ts b/src/plugins/data/public/search/search_source/parse_json.ts index f0eb377cedc77e..8f465253114240 100644 --- a/src/plugins/data/public/search/search_source/parse_json.ts +++ b/src/plugins/data/public/search/search_source/parse_json.ts @@ -18,7 +18,7 @@ */ import { SearchSourceFields } from './types'; -import { InvalidJSONProperty } from '../../../../kibana_utils/public'; +import { InvalidJSONProperty } from '../../../../kibana_utils/common'; export const parseSearchSourceJSON = (searchSourceJSON: string) => { // if we have a searchSource, set its values based on the searchSourceJson field diff --git a/src/plugins/data/public/search/search_source/search_source.ts b/src/plugins/data/public/search/search_source/search_source.ts index c97a5d0638a6ac..847dc8853d6ba5 100644 --- a/src/plugins/data/public/search/search_source/search_source.ts +++ b/src/plugins/data/public/search/search_source/search_source.ts @@ -75,7 +75,7 @@ import { map } from 'rxjs/operators'; import { CoreStart } from 'kibana/public'; import { normalizeSortRequest } from './normalize_sort_request'; import { filterDocvalueFields } from './filter_docvalue_fields'; -import { fieldWildcardFilter } from '../../../../kibana_utils/public'; +import { fieldWildcardFilter } from '../../../../kibana_utils/common'; import { IIndexPattern, ISearchGeneric, SearchRequest } from '../..'; import { SearchSourceOptions, SearchSourceFields } from './types'; import { FetchOptions, RequestFailure, handleResponse, getSearchParamsFromRequest } from '../fetch'; diff --git a/src/plugins/data/public/search/types.ts b/src/plugins/data/public/search/types.ts index ec74275f35c041..f80a13d048a684 100644 --- a/src/plugins/data/public/search/types.ts +++ b/src/plugins/data/public/search/types.ts @@ -37,6 +37,7 @@ import { GetInternalStartServicesFn } from '../types'; export interface ISearchOptions { signal?: AbortSignal; + strategy?: string; } export type ISearch = ( @@ -44,14 +45,9 @@ export type ISearch = ( options?: ISearchOptions ) => Observable; -// Service API types -export interface IStrategyOptions extends ISearchOptions { - strategy?: string; -} - export type ISearchGeneric = ( request: IEsSearchRequest, - options?: IStrategyOptions + options?: ISearchOptions ) => Observable; export interface ISearchStartLegacy { diff --git a/src/plugins/data/public/ui/query_string_input/query_string_input.test.tsx b/src/plugins/data/public/ui/query_string_input/query_string_input.test.tsx index 0397c34d0c2b89..bb0a8b848c89e4 100644 --- a/src/plugins/data/public/ui/query_string_input/query_string_input.test.tsx +++ b/src/plugins/data/public/ui/query_string_input/query_string_input.test.tsx @@ -186,6 +186,44 @@ describe('QueryStringInput', () => { expect(mockCallback).toHaveBeenCalledWith({ query: 'response:200', language: 'kuery' }); }); + it('Should fire onBlur callback on input blur', () => { + const mockCallback = jest.fn(); + + const component = mount( + wrapQueryStringInputInContext({ + query: kqlQuery, + onBlur: mockCallback, + indexPatterns: [stubIndexPatternWithFields], + disableAutoFocus: true, + }) + ); + + const inputWrapper = component.find(EuiTextArea).find('textarea'); + inputWrapper.simulate('blur'); + + expect(mockCallback).toHaveBeenCalledTimes(1); + expect(mockCallback).toHaveBeenCalledWith(); + }); + + it('Should fire onChangeQueryInputFocus callback on input blur', () => { + const mockCallback = jest.fn(); + + const component = mount( + wrapQueryStringInputInContext({ + query: kqlQuery, + onChangeQueryInputFocus: mockCallback, + indexPatterns: [stubIndexPatternWithFields], + disableAutoFocus: true, + }) + ); + + const inputWrapper = component.find(EuiTextArea).find('textarea'); + inputWrapper.simulate('blur'); + + expect(mockCallback).toHaveBeenCalledTimes(1); + expect(mockCallback).toHaveBeenCalledWith(false); + }); + it('Should use PersistedLog for recent search suggestions', async () => { const component = mount( wrapQueryStringInputInContext({ diff --git a/src/plugins/data/public/ui/query_string_input/query_string_input.tsx b/src/plugins/data/public/ui/query_string_input/query_string_input.tsx index 6f72aa829d8f37..86ee98b7af9d84 100644 --- a/src/plugins/data/public/ui/query_string_input/query_string_input.tsx +++ b/src/plugins/data/public/ui/query_string_input/query_string_input.tsx @@ -33,7 +33,7 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { debounce, compact, isEqual } from 'lodash'; +import { debounce, compact, isEqual, isFunction } from 'lodash'; import { Toast } from 'src/core/public'; import { IDataPluginServices, IIndexPattern, Query } from '../..'; import { QuerySuggestion, QuerySuggestionTypes } from '../../autocomplete'; @@ -460,6 +460,9 @@ export class QueryStringInputUI extends Component { if (this.props.onChangeQueryInputFocus) { this.props.onChangeQueryInputFocus(false); } + if (isFunction(this.props.onBlur)) { + this.props.onBlur(); + } }; private onClickSuggestion = (suggestion: QuerySuggestion) => { diff --git a/src/plugins/data/server/index.ts b/src/plugins/data/server/index.ts index 1f3d7fbcb9f0f0..73ed88850d7874 100644 --- a/src/plugins/data/server/index.ts +++ b/src/plugins/data/server/index.ts @@ -161,7 +161,12 @@ import { toAbsoluteDates, } from '../common'; -export { EsaggsExpressionFunctionDefinition, ParsedInterval } from '../common'; +export { + EsaggsExpressionFunctionDefinition, + ParsedInterval, + IEsSearchRequest, + IEsSearchResponse, +} from '../common'; export { ISearchStrategy, diff --git a/src/plugins/data/server/search/es_search/es_search_strategy.test.ts b/src/plugins/data/server/search/es_search/es_search_strategy.test.ts index bc59bdee6a40a0..2888f9d9d20b5d 100644 --- a/src/plugins/data/server/search/es_search/es_search_strategy.test.ts +++ b/src/plugins/data/server/search/es_search/es_search_strategy.test.ts @@ -78,7 +78,7 @@ describe('ES search strategy', () => { }); }); - it('returns total, loaded, and raw response', async () => { + it('has all response parameters', async () => { const params = { index: 'logstash-*' }; const esSearch = await esSearchStrategyProvider(mockConfig$, mockLogger); @@ -86,7 +86,8 @@ describe('ES search strategy', () => { params, }); - expect(response).toHaveProperty('total'); + expect(response.isRunning).toBe(false); + expect(response.isPartial).toBe(false); expect(response).toHaveProperty('loaded'); expect(response).toHaveProperty('rawResponse'); }); diff --git a/src/plugins/data/server/search/es_search/es_search_strategy.ts b/src/plugins/data/server/search/es_search/es_search_strategy.ts index 78ead6df1a44e6..234c30376d6db4 100644 --- a/src/plugins/data/server/search/es_search/es_search_strategy.ts +++ b/src/plugins/data/server/search/es_search/es_search_strategy.ts @@ -30,7 +30,7 @@ export const esSearchStrategyProvider = ( ): ISearchStrategy => { return { search: async (context, request, options) => { - logger.info(`search ${JSON.stringify(request.params)}`); + logger.info(`search ${request.params?.index}`); const config = await config$.pipe(first()).toPromise(); const defaultParams = getDefaultSearchParams(config); @@ -56,7 +56,12 @@ export const esSearchStrategyProvider = ( // The above query will either complete or timeout and throw an error. // There is no progress indication on this api. - return { rawResponse, ...getTotalLoaded(rawResponse._shards) }; + return { + isPartial: false, + isRunning: false, + rawResponse, + ...getTotalLoaded(rawResponse._shards), + }; } catch (e) { if (usage) usage.trackError(); throw e; diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md index 013034c79d3f31..37d569a4bf9fea 100644 --- a/src/plugins/data/server/server.api.md +++ b/src/plugins/data/server/server.api.md @@ -369,6 +369,30 @@ export function getTotalLoaded({ total, failed, successful }: ShardsResponse): { loaded: number; }; +// Warning: (ae-forgotten-export) The symbol "IKibanaSearchRequest" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "IEsSearchRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IEsSearchRequest extends IKibanaSearchRequest { + // (undocumented) + indexType?: string; + // Warning: (ae-forgotten-export) The symbol "ISearchRequestParams" needs to be exported by the entry point index.d.ts + // + // (undocumented) + params?: ISearchRequestParams; +} + +// Warning: (ae-forgotten-export) The symbol "IKibanaSearchResponse" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "IEsSearchResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IEsSearchResponse extends IKibanaSearchResponse { + isPartial?: boolean; + isRunning?: boolean; + // (undocumented) + rawResponse: SearchResponse; +} + // Warning: (ae-missing-release-tag) "IFieldFormatsRegistry" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) @@ -547,8 +571,6 @@ export interface ISearchSetup { export interface ISearchStart { getSearchStrategy: (name: string) => ISearchStrategy; // Warning: (ae-forgotten-export) The symbol "RequestHandlerContext" needs to be exported by the entry point index.d.ts - // Warning: (ae-forgotten-export) The symbol "IKibanaSearchRequest" needs to be exported by the entry point index.d.ts - // Warning: (ae-forgotten-export) The symbol "IKibanaSearchResponse" needs to be exported by the entry point index.d.ts // // (undocumented) search: (context: RequestHandlerContext, request: IKibanaSearchRequest, options: ISearchOptions) => Promise; @@ -560,9 +582,6 @@ export interface ISearchStart { export interface ISearchStrategy { // (undocumented) cancel?: (context: RequestHandlerContext, id: string) => Promise; - // Warning: (ae-forgotten-export) The symbol "IEsSearchRequest" needs to be exported by the entry point index.d.ts - // Warning: (ae-forgotten-export) The symbol "IEsSearchResponse" needs to be exported by the entry point index.d.ts - // // (undocumented) search: (context: RequestHandlerContext, request: IEsSearchRequest, options?: ISearchOptions) => Promise; } @@ -817,13 +836,13 @@ export function usageProvider(core: CoreSetup_2): SearchUsage; // src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts // src/plugins/data/server/index.ts:127:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts // src/plugins/data/server/index.ts:127:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:180:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:181:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:182:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:183:1 - (ae-forgotten-export) The symbol "Ipv4Address" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:184:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:185:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:188:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:185:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:186:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:187:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:188:1 - (ae-forgotten-export) The symbol "Ipv4Address" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:189:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:190:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:193:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts b/src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts index 751a59d9821534..00e00aa8e29913 100644 --- a/src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts +++ b/src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { difference, map } from 'lodash'; +import { difference } from 'lodash'; import { IndexPattern, IndexPatternField } from 'src/plugins/data/public'; export function getIndexPatternFieldList( @@ -26,7 +26,7 @@ export function getIndexPatternFieldList( if (!indexPattern || !fieldCounts) return []; const fieldNamesInDocs = Object.keys(fieldCounts); - const fieldNamesInIndexPattern = map(indexPattern.fields, 'name'); + const fieldNamesInIndexPattern = indexPattern.fields.getAll().map((fld) => fld.name); const unknownTypes: IndexPatternField[] = []; difference(fieldNamesInDocs, fieldNamesInIndexPattern).forEach((unknownFieldName) => { @@ -36,5 +36,5 @@ export function getIndexPatternFieldList( } as IndexPatternField); }); - return [...indexPattern.fields, ...unknownTypes]; + return [...indexPattern.fields.getAll(), ...unknownTypes]; } diff --git a/src/plugins/discover/public/application/components/table/table.test.tsx b/src/plugins/discover/public/application/components/table/table.test.tsx index 0793072fd0cf46..29659b39693656 100644 --- a/src/plugins/discover/public/application/components/table/table.test.tsx +++ b/src/plugins/discover/public/application/components/table/table.test.tsx @@ -24,45 +24,47 @@ import { DocViewTable } from './table'; import { indexPatterns, IndexPattern } from '../../../../../data/public'; const indexPattern = { - fields: [ - { - name: '_index', - type: 'string', - scripted: false, - filterable: true, - }, - { - name: 'message', - type: 'string', - scripted: false, - filterable: false, - }, - { - name: 'extension', - type: 'string', - scripted: false, - filterable: true, - }, - { - name: 'bytes', - type: 'number', - scripted: false, - filterable: true, - }, - { - name: 'scripted', - type: 'number', - scripted: true, - filterable: false, - }, - ], + fields: { + getAll: () => [ + { + name: '_index', + type: 'string', + scripted: false, + filterable: true, + }, + { + name: 'message', + type: 'string', + scripted: false, + filterable: false, + }, + { + name: 'extension', + type: 'string', + scripted: false, + filterable: true, + }, + { + name: 'bytes', + type: 'number', + scripted: false, + filterable: true, + }, + { + name: 'scripted', + type: 'number', + scripted: true, + filterable: false, + }, + ], + }, metaFields: ['_index', '_score'], flattenHit: undefined, formatHit: jest.fn((hit) => hit._source), } as IndexPattern; indexPattern.fields.getByName = (name: string) => { - return indexPattern.fields.find((field) => field.name === name); + return indexPattern.fields.getAll().find((field) => field.name === name); }; indexPattern.flattenHit = indexPatterns.flattenHitWrapper(indexPattern, indexPattern.metaFields); diff --git a/src/plugins/discover/public/application/components/table/table.tsx b/src/plugins/discover/public/application/components/table/table.tsx index 9b95f2fc6bd27f..628045bd32f612 100644 --- a/src/plugins/discover/public/application/components/table/table.tsx +++ b/src/plugins/discover/public/application/components/table/table.tsx @@ -104,15 +104,13 @@ export function DocViewTable({ // to the index pattern, but that has its own complications which you can read more about in the following // issue: https://github.com/elastic/kibana/issues/54957 const isNestedField = - !indexPattern.fields.find((patternField) => patternField.name === field) && - !!indexPattern.fields.find((patternField) => { + !indexPattern.fields.getByName(field) && + !!indexPattern.fields.getAll().find((patternField) => { // We only want to match a full path segment const nestedRootRegex = new RegExp(escapeRegExp(field) + '(\\.|$)'); return nestedRootRegex.test(patternField.subType?.nested?.path ?? ''); }); - const fieldType = isNestedField - ? 'nested' - : indexPattern.fields.find((patternField) => patternField.name === field)?.type; + const fieldType = isNestedField ? 'nested' : indexPattern.fields.getByName(field)?.type; return ( { const fn = functionWrapper(font); + const args = { + align: 'left', + color: null, + family: openSans.value, + italic: false, + lHeight: null, + size: 14, + underline: false, + weight: 'normal', + }; + describe('default output', () => { - const result = fn(null); + const result = fn(null, args); it('returns a style', () => { expect(result).toMatchObject({ @@ -39,7 +50,7 @@ describe('font', () => { describe('args', () => { describe('size', () => { it('sets font size', () => { - const result = fn(null, { size: 20 }); + const result = fn(null, { ...args, size: 20 }); expect(result).toMatchObject({ spec: { fontSize: '20px', @@ -47,21 +58,11 @@ describe('font', () => { }); expect(result.css).toContain('font-size:20px'); }); - - it('defaults to 14px', () => { - const result = fn(null); - expect(result).toMatchObject({ - spec: { - fontSize: '14px', - }, - }); - expect(result.css).toContain('font-size:14px'); - }); }); describe('lHeight', () => { it('sets line height', () => { - const result = fn(null, { lHeight: 30 }); + const result = fn(null, { ...args, lHeight: 30 }); expect(result).toMatchObject({ spec: { lineHeight: '30px', @@ -69,31 +70,19 @@ describe('font', () => { }); expect(result.css).toContain('line-height:30px'); }); - - it('defaults to 1', () => { - const result = fn(null); - expect(result.spec.lineHeight).toBe('1'); - expect(result.css).toContain('line-height:1'); - }); }); describe('family', () => { it('sets font family', () => { - const result = fn(null, { family: 'Optima, serif' }); + const result = fn(null, { ...args, family: 'Optima, serif' }); expect(result.spec.fontFamily).toBe('Optima, serif'); expect(result.css).toContain('font-family:Optima, serif'); }); - - it(`defaults to "${openSans.value}"`, () => { - const result = fn(null); - expect(result.spec.fontFamily).toBe(`"${openSans.value}"`); - expect(result.css).toContain(`font-family:"${openSans.value}"`); - }); }); describe('color', () => { it('sets font color', () => { - const result = fn(null, { color: 'blue' }); + const result = fn(null, { ...args, color: 'blue' }); expect(result.spec.color).toBe('blue'); expect(result.css).toContain('color:blue'); }); @@ -101,51 +90,39 @@ describe('font', () => { describe('weight', () => { it('sets font weight', () => { - let result = fn(null, { weight: 'normal' }); + let result = fn(null, { ...args, weight: 'normal' }); expect(result.spec.fontWeight).toBe('normal'); expect(result.css).toContain('font-weight:normal'); - result = fn(null, { weight: 'bold' }); + result = fn(null, { ...args, weight: 'bold' }); expect(result.spec.fontWeight).toBe('bold'); expect(result.css).toContain('font-weight:bold'); - result = fn(null, { weight: 'bolder' }); + result = fn(null, { ...args, weight: 'bolder' }); expect(result.spec.fontWeight).toBe('bolder'); expect(result.css).toContain('font-weight:bolder'); - result = fn(null, { weight: 'lighter' }); + result = fn(null, { ...args, weight: 'lighter' }); expect(result.spec.fontWeight).toBe('lighter'); expect(result.css).toContain('font-weight:lighter'); - result = fn(null, { weight: '400' }); + result = fn(null, { ...args, weight: '400' }); expect(result.spec.fontWeight).toBe('400'); expect(result.css).toContain('font-weight:400'); }); - it("defaults to 'normal'", () => { - const result = fn(null); - expect(result.spec.fontWeight).toBe('normal'); - expect(result.css).toContain('font-weight:normal'); - }); - it('throws when provided an invalid weight', () => { - expect(() => fn(null, { weight: 'foo' })).toThrow(); + expect(() => fn(null, { ...args, weight: 'foo' })).toThrow(); }); }); describe('underline', () => { it('sets text underline', () => { - let result = fn(null, { underline: true }); + let result = fn(null, { ...args, underline: true }); expect(result.spec.textDecoration).toBe('underline'); expect(result.css).toContain('text-decoration:underline'); - result = fn(null, { underline: false }); - expect(result.spec.textDecoration).toBe('none'); - expect(result.css).toContain('text-decoration:none'); - }); - - it('defaults to false', () => { - const result = fn(null); + result = fn(null, { ...args, underline: false }); expect(result.spec.textDecoration).toBe('none'); expect(result.css).toContain('text-decoration:none'); }); @@ -153,17 +130,11 @@ describe('font', () => { describe('italic', () => { it('sets italic', () => { - let result = fn(null, { italic: true }); + let result = fn(null, { ...args, italic: true }); expect(result.spec.fontStyle).toBe('italic'); expect(result.css).toContain('font-style:italic'); - result = fn(null, { italic: false }); - expect(result.spec.fontStyle).toBe('normal'); - expect(result.css).toContain('font-style:normal'); - }); - - it('defaults to false', () => { - const result = fn(null); + result = fn(null, { ...args, italic: false }); expect(result.spec.fontStyle).toBe('normal'); expect(result.css).toContain('font-style:normal'); }); @@ -171,31 +142,25 @@ describe('font', () => { describe('align', () => { it('sets text alignment', () => { - let result = fn(null, { align: 'left' }); + let result = fn(null, { ...args, align: 'left' }); expect(result.spec.textAlign).toBe('left'); expect(result.css).toContain('text-align:left'); - result = fn(null, { align: 'center' }); + result = fn(null, { ...args, align: 'center' }); expect(result.spec.textAlign).toBe('center'); expect(result.css).toContain('text-align:center'); - result = fn(null, { align: 'right' }); + result = fn(null, { ...args, align: 'right' }); expect(result.spec.textAlign).toBe('right'); expect(result.css).toContain('text-align:right'); - result = fn(null, { align: 'justify' }); + result = fn(null, { ...args, align: 'justify' }); expect(result.spec.textAlign).toBe('justify'); expect(result.css).toContain('text-align:justify'); }); - it(`defaults to 'left'`, () => { - const result = fn(null); - expect(result.spec.textAlign).toBe('left'); - expect(result.css).toContain('text-align:left'); - }); - it('throws when provided an invalid alignment', () => { - expect(() => fn(null, { align: 'foo' })).toThrow(); + expect(() => fn(null, { ...args, align: 'foo' })).toThrow(); }); }); }); diff --git a/src/plugins/expressions/common/expression_functions/specs/tests/theme.test.ts b/src/plugins/expressions/common/expression_functions/specs/tests/theme.test.ts new file mode 100644 index 00000000000000..263409f0caca28 --- /dev/null +++ b/src/plugins/expressions/common/expression_functions/specs/tests/theme.test.ts @@ -0,0 +1,63 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { functionWrapper } from './utils'; +import { theme } from '../theme'; +import { ExecutionContext } from '../../../execution/types'; + +describe('expression_functions', () => { + describe('theme', () => { + const fn = functionWrapper(theme); + let context: ExecutionContext; + + let themeProps; + + beforeEach(() => { + themeProps = { + font: { + family: 'Arial', + size: 14, + }, + }; + + context = { + getInitialInput: () => {}, + types: {}, + variables: { theme: themeProps }, + abortSignal: {} as any, + inspectorAdapters: {} as any, + }; + }); + + it('returns the selected variable', () => { + const actual = fn(null, { variable: 'font.family' }, context); + expect(actual).toEqual('Arial'); + }); + + it('returns undefined if variable does not exist', () => { + const actual = fn(null, { variable: 'font.weight' }, context); + expect(actual).toEqual(undefined); + }); + + it('returns default if variable does not exist and default is provided', () => { + const actual = fn(null, { variable: 'font.weight', default: 'normal' }, context); + expect(actual).toEqual('normal'); + }); + }); +}); diff --git a/src/plugins/expressions/common/expression_functions/specs/theme.ts b/src/plugins/expressions/common/expression_functions/specs/theme.ts new file mode 100644 index 00000000000000..e27b01674cb5ee --- /dev/null +++ b/src/plugins/expressions/common/expression_functions/specs/theme.ts @@ -0,0 +1,65 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { i18n } from '@kbn/i18n'; +import { get } from 'lodash'; +import { ExpressionFunctionDefinition } from '../types'; + +interface Arguments { + variable: string; + default: string | number | boolean; +} + +type Output = any; + +export type ExpressionFunctionTheme = ExpressionFunctionDefinition< + 'theme', + null, + Arguments, + Output +>; + +export const theme: ExpressionFunctionTheme = { + name: 'theme', + aliases: [], + help: i18n.translate('expressions.functions.themeHelpText', { + defaultMessage: 'Reads a theme setting.', + }), + inputTypes: ['null'], + args: { + variable: { + aliases: ['_'], + help: i18n.translate('expressions.functions.theme.args.variableHelpText', { + defaultMessage: 'Name of the theme variable to read.', + }), + required: true, + types: ['string'], + }, + default: { + help: i18n.translate('expressions.functions.theme.args.defaultHelpText', { + defaultMessage: 'default value in case theming info is not available.', + }), + }, + }, + fn: (input, args, handlers) => { + // currently we use variable `theme`, but external theme service would be preferable + const vars = handlers.variables.theme || {}; + return get(vars, args.variable, args.default); + }, +}; diff --git a/src/plugins/expressions/common/expression_functions/types.ts b/src/plugins/expressions/common/expression_functions/types.ts index 5979bcffb3175e..d58d872aff7228 100644 --- a/src/plugins/expressions/common/expression_functions/types.ts +++ b/src/plugins/expressions/common/expression_functions/types.ts @@ -28,6 +28,7 @@ import { ExpressionFunctionKibana, ExpressionFunctionVarSet, ExpressionFunctionVar, + ExpressionFunctionTheme, } from './specs'; /** @@ -122,4 +123,5 @@ export interface ExpressionFunctionDefinitions { kibana: ExpressionFunctionKibana; var_set: ExpressionFunctionVarSet; var: ExpressionFunctionVar; + theme: ExpressionFunctionTheme; } diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern.tsx index 090c72d319f8c2..4b538af7c5fe79 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern.tsx @@ -93,14 +93,16 @@ export const EditIndexPattern = withRouter( } = useKibana().services; const [fields, setFields] = useState(indexPattern.getNonScriptedFields()); const [conflictedFields, setConflictedFields] = useState( - indexPattern.fields.filter((field) => field.type === 'conflict') + indexPattern.fields.getAll().filter((field) => field.type === 'conflict') ); const [defaultIndex, setDefaultIndex] = useState(uiSettings.get('defaultIndex')); const [tags, setTags] = useState([]); useEffect(() => { setFields(indexPattern.getNonScriptedFields()); - setConflictedFields(indexPattern.fields.filter((field) => field.type === 'conflict')); + setConflictedFields( + indexPattern.fields.getAll().filter((field) => field.type === 'conflict') + ); }, [indexPattern]); useEffect(() => { diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx index a59dca80a3684b..f32eb63ad04b45 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx @@ -87,7 +87,7 @@ export function Tabs({ indexPattern, fields, history, location }: TabsProps) { const refreshFilters = useCallback(() => { const tempIndexedFieldTypes: string[] = []; const tempScriptedFieldLanguages: string[] = []; - indexPattern.fields.forEach((field) => { + indexPattern.fields.getAll().forEach((field) => { if (field.scripted) { if (field.lang) { tempScriptedFieldLanguages.push(field.lang); diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/utils.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/utils.ts index 5ab9c695caaa04..b422de93de7a97 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/utils.ts +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/utils.ts @@ -84,9 +84,9 @@ export function getTabs( fieldFilter: string, indexPatternListProvider: IndexPatternManagementStart['list'] ) { - const totalCount = getCounts(indexPattern.fields, indexPattern.getSourceFiltering()); + const totalCount = getCounts(indexPattern.fields.getAll(), indexPattern.getSourceFiltering()); const filteredCount = getCounts( - indexPattern.fields, + indexPattern.fields.getAll(), indexPattern.getSourceFiltering(), fieldFilter ); diff --git a/src/plugins/index_pattern_management/public/components/field_editor/__snapshots__/field_editor.test.tsx.snap b/src/plugins/index_pattern_management/public/components/field_editor/__snapshots__/field_editor.test.tsx.snap index c22160bc4036d8..3f4190eed91707 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/__snapshots__/field_editor.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/field_editor/__snapshots__/field_editor.test.tsx.snap @@ -25,11 +25,10 @@ exports[`FieldEditor should render create new scripted field correctly 1`] = ` executeScript={[Function]} indexPattern={ Object { - "fields": Array [ - Object { - "name": "foobar", - }, - ], + "fields": Object { + "getAll": [Function], + "getByName": [Function], + }, "getFormatterForField": [Function], } } @@ -261,19 +260,10 @@ exports[`FieldEditor should render edit scripted field correctly 1`] = ` executeScript={[Function]} indexPattern={ Object { - "fields": Array [ - Object { - "name": "foobar", - }, - Object { - "format": Format {}, - "lang": "painless", - "name": "test", - "script": "doc.test.value", - "scripted": true, - "type": "number", - }, - ], + "fields": Object { + "getAll": [Function], + "getByName": [Function], + }, "getFormatterForField": [Function], } } @@ -504,27 +494,10 @@ exports[`FieldEditor should show conflict field warning 1`] = ` executeScript={[Function]} indexPattern={ Object { - "fields": Array [ - Object { - "name": "foobar", - }, - Object { - "format": Format {}, - "lang": "painless", - "name": "test", - "script": "doc.test.value", - "scripted": true, - "type": "number", - }, - Object { - "format": Format {}, - "lang": "testlang", - "name": "test", - "script": "doc.test.value", - "scripted": true, - "type": "number", - }, - ], + "fields": Object { + "getAll": [Function], + "getByName": [Function], + }, "getFormatterForField": [Function], } } @@ -784,27 +757,10 @@ exports[`FieldEditor should show deprecated lang warning 1`] = ` executeScript={[Function]} indexPattern={ Object { - "fields": Array [ - Object { - "name": "foobar", - }, - Object { - "format": Format {}, - "lang": "painless", - "name": "test", - "script": "doc.test.value", - "scripted": true, - "type": "number", - }, - Object { - "format": Format {}, - "lang": "testlang", - "name": "test", - "script": "doc.test.value", - "scripted": true, - "type": "number", - }, - ], + "fields": Object { + "getAll": [Function], + "getByName": [Function], + }, "getFormatterForField": [Function], } } @@ -1116,27 +1072,10 @@ exports[`FieldEditor should show multiple type field warning with a table contai executeScript={[Function]} indexPattern={ Object { - "fields": Array [ - Object { - "name": "foobar", - }, - Object { - "format": Format {}, - "lang": "painless", - "name": "test", - "script": "doc.test.value", - "scripted": true, - "type": "number", - }, - Object { - "format": Format {}, - "lang": "testlang", - "name": "test", - "script": "doc.test.value", - "scripted": true, - "type": "number", - }, - ], + "fields": Object { + "getAll": [Function], + "getByName": [Function], + }, "getFormatterForField": [Function], } } diff --git a/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx index cb1d5a25c01ae6..77c6698fdc337d 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx @@ -188,6 +188,7 @@ export class TestScript extends Component { const fields: EuiComboBoxOptionOption[] = []; this.props.indexPattern.fields + .getAll() .filter((field) => { const isMultiField = field.subType && field.subType.multi; return !field.name.startsWith('_') && !isMultiField && !field.scripted; diff --git a/src/plugins/index_pattern_management/public/components/field_editor/field_editor.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/field_editor.test.tsx index ba1f2ff4b665d9..96d3fc549ece01 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/field_editor.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/field_editor.test.tsx @@ -17,12 +17,7 @@ * under the License. */ -import { - IndexPattern, - IndexPatternField, - IIndexPatternFieldList, - FieldFormatInstanceType, -} from 'src/plugins/data/public'; +import { IndexPattern, IndexPatternField, FieldFormatInstanceType } from 'src/plugins/data/public'; jest.mock('brace/mode/groovy', () => ({})); @@ -71,15 +66,19 @@ jest.mock('./components/field_format_editor', () => ({ FieldFormatEditor: 'field-format-editor', })); -const fields: IndexPatternField[] = [ +const fieldList = [ { name: 'foobar', } as IndexPatternField, ]; +const fields = { + getAll: () => fieldList, +}; + // @ts-ignore fields.getByName = (name: string) => { - return fields.find((field) => field.name === name); + return fields.getAll().find((field) => field.name === name); }; class Format { @@ -112,7 +111,7 @@ describe('FieldEditor', () => { beforeEach(() => { indexPattern = ({ - fields: fields as IIndexPatternFieldList, + fields, getFormatterForField: () => ({ params: () => ({}) }), } as unknown) as IndexPattern; }); @@ -139,7 +138,7 @@ describe('FieldEditor', () => { name: 'test', script: 'doc.test.value', }; - indexPattern.fields.push(testField as IndexPatternField); + fieldList.push(testField as IndexPatternField); indexPattern.fields.getByName = (name) => { const flds = { [testField.name]: testField, @@ -169,7 +168,7 @@ describe('FieldEditor', () => { script: 'doc.test.value', lang: 'testlang', }; - indexPattern.fields.push((testField as unknown) as IndexPatternField); + fieldList.push((testField as unknown) as IndexPatternField); indexPattern.fields.getByName = (name) => { const flds = { [testField.name]: testField, diff --git a/src/plugins/index_pattern_management/public/components/field_editor/field_editor.tsx b/src/plugins/index_pattern_management/public/components/field_editor/field_editor.tsx index d78e1e1014581e..6a3f632a9582ee 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/field_editor.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/field_editor.tsx @@ -155,7 +155,7 @@ export class FieldEditor extends PureComponent f.name), + existingFieldNames: indexPattern.fields.getAll().map((f: IFieldType) => f.name), fieldFormatId: undefined, fieldFormatParams: {}, showScriptingHelp: false, @@ -197,7 +197,7 @@ export class FieldEditor extends PureComponent f.name === spec.name), + isCreating: !indexPattern.fields.getByName(spec.name), isDeprecatedLang: this.deprecatedLangs.includes(spec.lang || ''), errors: [], scriptingLangs, @@ -804,11 +804,11 @@ export class FieldEditor extends PureComponent f.name === field.name); + const fieldExists = !!indexPattern.fields.getByName(field.name); let oldField: IndexPatternField['spec']; - if (index > -1) { + if (fieldExists) { oldField = indexPattern.fields.getByName(field.name)!.spec; indexPattern.fields.update(field); } else { diff --git a/src/plugins/input_control_vis/public/control/list_control_factory.ts b/src/plugins/input_control_vis/public/control/list_control_factory.ts index 65a3e37a93edf5..acbbf08c7d004f 100644 --- a/src/plugins/input_control_vis/public/control/list_control_factory.ts +++ b/src/plugins/input_control_vis/public/control/list_control_factory.ts @@ -216,7 +216,7 @@ export async function listControlFactory( // dynamic options are only allowed on String fields but the setting defaults to true so it could // be enabled for non-string fields (since UI input is hidden for non-string fields). // If field is not string, then disable dynamic options. - const field = indexPattern.fields.find(({ name }) => name === controlParams.fieldName); + const field = indexPattern.fields.getAll().find(({ name }) => name === controlParams.fieldName); if (field && field.type !== 'string') { controlParams.options.dynamicOptions = false; } diff --git a/src/plugins/input_control_vis/public/test_utils/get_deps_mock.tsx b/src/plugins/input_control_vis/public/test_utils/get_deps_mock.tsx index feedcab1850eb7..f72bc96f9e7c18 100644 --- a/src/plugins/input_control_vis/public/test_utils/get_deps_mock.tsx +++ b/src/plugins/input_control_vis/public/test_utils/get_deps_mock.tsx @@ -26,6 +26,7 @@ fields.push({ name: 'myField' } as any); fields.getByName = (name: any) => { return fields.find(({ name: n }: { name: string }) => n === name); }; +fields.getAll = () => [...fields]; export const getDepsMock = ({ searchSource = { diff --git a/src/plugins/kibana_legacy/common/index.ts b/src/plugins/kibana_legacy/common/index.ts new file mode 100644 index 00000000000000..9c16d7b273862c --- /dev/null +++ b/src/plugins/kibana_legacy/common/index.ts @@ -0,0 +1,21 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export * from './kbn_base_url'; +export * from './migrate_legacy_query'; diff --git a/src/plugins/kibana_legacy/public/utils/migrate_legacy_query.ts b/src/plugins/kibana_legacy/common/migrate_legacy_query.ts similarity index 100% rename from src/plugins/kibana_legacy/public/utils/migrate_legacy_query.ts rename to src/plugins/kibana_legacy/common/migrate_legacy_query.ts diff --git a/src/plugins/kibana_legacy/kibana.json b/src/plugins/kibana_legacy/kibana.json index 606acd8b88b050..79264d95dcc27f 100644 --- a/src/plugins/kibana_legacy/kibana.json +++ b/src/plugins/kibana_legacy/kibana.json @@ -3,5 +3,5 @@ "version": "kibana", "server": true, "ui": true, - "extraPublicDirs": ["common/kbn_base_url"] + "extraPublicDirs": ["common", "common/kbn_base_url"] } diff --git a/src/plugins/kibana_legacy/public/index.ts b/src/plugins/kibana_legacy/public/index.ts index 75e81b05057470..27b940b0a456b3 100644 --- a/src/plugins/kibana_legacy/public/index.ts +++ b/src/plugins/kibana_legacy/public/index.ts @@ -24,7 +24,7 @@ export const plugin = (initializerContext: PluginInitializerContext) => new KibanaLegacyPlugin(initializerContext); export * from './plugin'; -export { kbnBaseUrl } from '../common/kbn_base_url'; +export { kbnBaseUrl, migrateLegacyQuery } from '../common'; export { initAngularBootstrap } from './angular_bootstrap'; export { PaginateDirectiveProvider, PaginateControlsDirectiveProvider } from './paginate/paginate'; diff --git a/src/plugins/kibana_legacy/public/utils/index.ts b/src/plugins/kibana_legacy/public/utils/index.ts index e7dd55ec5582b4..a32cd5e40a0477 100644 --- a/src/plugins/kibana_legacy/public/utils/index.ts +++ b/src/plugins/kibana_legacy/public/utils/index.ts @@ -17,7 +17,6 @@ * under the License. */ -export * from './migrate_legacy_query'; export * from './system_api'; export * from './normalize_path'; // @ts-ignore diff --git a/src/plugins/kibana_legacy/server/index.ts b/src/plugins/kibana_legacy/server/index.ts index 0188f9b1ec515d..3ddcac1517f74a 100644 --- a/src/plugins/kibana_legacy/server/index.ts +++ b/src/plugins/kibana_legacy/server/index.ts @@ -50,7 +50,7 @@ export const config: PluginConfigDescriptor = { ], }; -export { kbnBaseUrl } from '../common/kbn_base_url'; +export { kbnBaseUrl, migrateLegacyQuery } from '../common'; class Plugin { public setup(core: CoreSetup) {} diff --git a/src/plugins/kibana_utils/public/field_wildcard/field_wildcard.test.ts b/src/plugins/kibana_utils/common/field_wildcard.test.ts similarity index 100% rename from src/plugins/kibana_utils/public/field_wildcard/field_wildcard.test.ts rename to src/plugins/kibana_utils/common/field_wildcard.test.ts diff --git a/src/plugins/kibana_utils/public/field_wildcard/field_wildcard.ts b/src/plugins/kibana_utils/common/field_wildcard.ts similarity index 99% rename from src/plugins/kibana_utils/public/field_wildcard/field_wildcard.ts rename to src/plugins/kibana_utils/common/field_wildcard.ts index 2aa9a255bd5cf7..bfe5a0f3a0a8e9 100644 --- a/src/plugins/kibana_utils/public/field_wildcard/field_wildcard.ts +++ b/src/plugins/kibana_utils/common/field_wildcard.ts @@ -19,6 +19,7 @@ import { escapeRegExp, memoize } from 'lodash'; +// @internal export const makeRegEx = memoize(function makeRegEx(glob: string) { const globRegex = glob.split('*').map(escapeRegExp).join('.*'); return new RegExp(`^${globRegex}$`); diff --git a/src/plugins/kibana_utils/common/index.ts b/src/plugins/kibana_utils/common/index.ts index c94021872b4e10..1ec5737c5a38b1 100644 --- a/src/plugins/kibana_utils/common/index.ts +++ b/src/plugins/kibana_utils/common/index.ts @@ -18,6 +18,7 @@ */ export * from './defer'; +export * from './field_wildcard'; export * from './of'; export * from './ui'; export * from './state_containers'; diff --git a/src/plugins/kibana_utils/public/index.ts b/src/plugins/kibana_utils/public/index.ts index d1c9eec0e9906e..7edf62ce04e819 100644 --- a/src/plugins/kibana_utils/public/index.ts +++ b/src/plugins/kibana_utils/public/index.ts @@ -21,6 +21,8 @@ export { calculateObjectHash, defer, Defer, + fieldWildcardFilter, + fieldWildcardMatcher, Get, JsonArray, JsonObject, @@ -34,7 +36,6 @@ export { } from '../common'; export * from './core'; export * from '../common/errors'; -export * from './field_wildcard'; export * from './render_complete'; export * from './resize_checker'; export * from '../common/state_containers'; diff --git a/src/plugins/kibana_utils/server/index.ts b/src/plugins/kibana_utils/server/index.ts index b8b768da0192e5..bf3361d1e5369b 100644 --- a/src/plugins/kibana_utils/server/index.ts +++ b/src/plugins/kibana_utils/server/index.ts @@ -17,4 +17,11 @@ * under the License. */ -export { Get, Set, createGetterSetter, url } from '../common'; +export { + createGetterSetter, + fieldWildcardFilter, + fieldWildcardMatcher, + Get, + Set, + url, +} from '../common'; diff --git a/src/plugins/usage_collection/README.md b/src/plugins/usage_collection/README.md index a828096f86042e..4f0f10703c5e91 100644 --- a/src/plugins/usage_collection/README.md +++ b/src/plugins/usage_collection/README.md @@ -10,8 +10,6 @@ To integrate with the telemetry services for usage collection of your feature, t All you need to provide is a `type` for organizing your fields, `schema` field to define the expected types of usage fields reported, and a `fetch` method for returning your usage data. Then you need to make the Telemetry service aware of the collector by registering it. -### New Platform - 1. Make sure `usageCollection` is in your optional Plugins: ```json @@ -205,6 +203,10 @@ There are a few ways you can test that your usage collector is working properly. # UI Metric app +The UI metrics implementation in its current state is not useful. We are working on improving the implementation to enable teams to use the data to visualize and gather information from what is being reported. Please refer to the telemetry team if you are interested in adding ui_metrics to your plugin. + +**Until a better implementation is introduced, please defer from adding any new ui metrics.** + ## Purpose The purpose of the UI Metric app is to provide a tool for gathering data on how users interact with diff --git a/src/plugins/vis_type_timelion/public/helpers/arg_value_suggestions.ts b/src/plugins/vis_type_timelion/public/helpers/arg_value_suggestions.ts index 19ec46bd7f6598..85d41aab5859d2 100644 --- a/src/plugins/vis_type_timelion/public/helpers/arg_value_suggestions.ts +++ b/src/plugins/vis_type_timelion/public/helpers/arg_value_suggestions.ts @@ -117,6 +117,7 @@ export function getArgValueSuggestions() { const valueSplit = partial.split(':'); return indexPattern.fields + .getAll() .filter((field) => { return ( field.aggregatable && @@ -136,6 +137,7 @@ export function getArgValueSuggestions() { } return indexPattern.fields + .getAll() .filter((field) => { return ( field.aggregatable && @@ -155,6 +157,7 @@ export function getArgValueSuggestions() { } return indexPattern.fields + .getAll() .filter((field) => { return ( 'date' === field.type && diff --git a/src/plugins/vis_type_vega/public/data_model/vega_parser.test.js b/src/plugins/vis_type_vega/public/data_model/vega_parser.test.js index 62563dce2a18d5..ac92f31b890edb 100644 --- a/src/plugins/vis_type_vega/public/data_model/vega_parser.test.js +++ b/src/plugins/vis_type_vega/public/data_model/vega_parser.test.js @@ -28,6 +28,18 @@ jest.mock('../lib/vega', () => ({ vegaLite: jest.requireActual('vega-lite'), })); +describe(`VegaParser.parseAsync`, () => { + test(`should throw an error in case of $spec is not defined`, async () => { + const vp = new VegaParser('{}'); + + await vp.parseAsync(); + + expect( + vp.error.startsWith('Your specification requires a "$schema" field with a valid URL') + ).toBeTruthy(); + }); +}); + describe(`VegaParser._setDefaultValue`, () => { function check(spec, expected, ...params) { return () => { @@ -149,23 +161,14 @@ describe('VegaParser._resolveEsQueries', () => { ); }); -describe('VegaParser._parseSchema', () => { - function check(schema, isVegaLite, warningCount) { +describe('VegaParser.parseSchema', () => { + function check(schema, isVegaLite) { return () => { const vp = new VegaParser({ $schema: schema }); - expect(vp._parseSchema()).toBe(isVegaLite); - expect(vp.spec).toEqual({ $schema: schema }); - expect(vp.warnings).toHaveLength(warningCount); + expect(vp.parseSchema(vp.spec).isVegaLite).toBe(isVegaLite); }; } - test('should warn on no vega version specified', () => { - const vp = new VegaParser({}); - expect(vp._parseSchema()).toBe(false); - expect(vp.spec).toEqual({ $schema: 'https://vega.github.io/schema/vega/v5.json' }); - expect(vp.warnings).toHaveLength(1); - }); - test( 'should not warn on current vega version', check('https://vega.github.io/schema/vega/v5.json', false, 0) diff --git a/src/plugins/vis_type_vega/public/data_model/vega_parser.ts b/src/plugins/vis_type_vega/public/data_model/vega_parser.ts index 94d79071b8ef22..aceeefd9536553 100644 --- a/src/plugins/vis_type_vega/public/data_model/vega_parser.ts +++ b/src/plugins/vis_type_vega/public/data_model/vega_parser.ts @@ -55,7 +55,6 @@ const locToDirMap: Record = { top: 'column-reverse', bottom: 'column', }; -const DEFAULT_SCHEMA: string = 'https://vega.github.io/schema/vega/v5.json'; // If there is no "%type%" parameter, use this parser const DEFAULT_PARSER: string = 'elasticsearch'; @@ -117,8 +116,27 @@ export class VegaParser { if (this.isVegaLite !== undefined) throw new Error(); if (typeof this.spec === 'string') { - this.spec = hjson.parse(this.spec, { legacyRoot: false }); + const spec = hjson.parse(this.spec, { legacyRoot: false }); + + if (!spec.$schema) { + throw new Error( + i18n.translate('visTypeVega.vegaParser.inputSpecDoesNotSpecifySchemaErrorMessage', { + defaultMessage: `Your specification requires a {schemaParam} field with a valid URL for +Vega (see {vegaSchemaUrl}) or +Vega-Lite (see {vegaLiteSchemaUrl}). +The URL is an identifier only. Kibana and your browser will never access this URL.`, + values: { + schemaParam: '"$schema"', + vegaLiteSchemaUrl: 'https://vega.github.io/vega-lite/docs/spec.html#top-level', + vegaSchemaUrl: + 'https://vega.github.io/vega/docs/specification/#top-level-specification-properties', + }, + }) + ); + } + this.spec = spec; } + if (!_.isPlainObject(this.spec)) { throw new Error( i18n.translate('visTypeVega.vegaParser.invalidVegaSpecErrorMessage', { @@ -126,7 +144,7 @@ export class VegaParser { }) ); } - this.isVegaLite = this._parseSchema(); + this.isVegaLite = this.parseSchema(this.spec).isVegaLite; this.useHover = !this.isVegaLite; this._config = this._parseConfig(); @@ -497,23 +515,11 @@ export class VegaParser { /** * Parse Vega schema element - * @returns {boolean} is this a VegaLite schema? + * @returns {object} isVegaLite, libVersion * @private */ - _parseSchema() { - if (!this.spec) return false; - if (!this.spec.$schema) { - this._onWarning( - i18n.translate('visTypeVega.vegaParser.inputSpecDoesNotSpecifySchemaWarningMessage', { - defaultMessage: - 'The input spec does not specify a {schemaParam}, defaulting to {defaultSchema}', - values: { defaultSchema: `"${DEFAULT_SCHEMA}"`, schemaParam: '"$schema"' }, - }) - ); - this.spec.$schema = DEFAULT_SCHEMA; - } - - const schema = schemaParser(this.spec.$schema); + private parseSchema(spec: VegaSpec) { + const schema = schemaParser(spec.$schema); const isVegaLite = schema.library === 'vega-lite'; const libVersion = isVegaLite ? vegaLite.version : vega.version; @@ -531,7 +537,7 @@ export class VegaParser { ); } - return isVegaLite; + return { isVegaLite, libVersion }; } /** diff --git a/test/functional/apps/visualize/_tsvb_chart.ts b/test/functional/apps/visualize/_tsvb_chart.ts index ab76598ae2ea53..18d6e93090e8b5 100644 --- a/test/functional/apps/visualize/_tsvb_chart.ts +++ b/test/functional/apps/visualize/_tsvb_chart.ts @@ -26,7 +26,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const inspector = getService('inspector'); const retry = getService('retry'); const security = getService('security'); - const PageObjects = getPageObjects(['visualize', 'visualBuilder', 'timePicker', 'visChart']); + const PageObjects = getPageObjects([ + 'visualize', + 'visualBuilder', + 'timePicker', + 'visChart', + 'common', + ]); describe('visual builder', function describeIndexTests() { this.tags('includeFirefox'); @@ -132,6 +138,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await retry.tryForTime(20000, async () => { await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime); await PageObjects.visualBuilder.setIndexPatternValue('kibana_sample_data_flights'); + await PageObjects.common.sleep(3000); await PageObjects.visualBuilder.selectIndexPatternTimeField('timestamp'); }); const newValue = await PageObjects.visualBuilder.getMetricValue(); diff --git a/test/functional/page_objects/visual_builder_page.ts b/test/functional/page_objects/visual_builder_page.ts index 2771982fecdea3..f376c39ff67bbe 100644 --- a/test/functional/page_objects/visual_builder_page.ts +++ b/test/functional/page_objects/visual_builder_page.ts @@ -420,7 +420,7 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro public async setIndexPatternValue(value: string) { const el = await testSubjects.find('metricsIndexPatternInput'); await el.clearValue(); - await el.type(value); + await el.type(value, { charByChar: true }); await PageObjects.header.waitUntilLoadingHasFinished(); } diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index d0055008eb9bf7..69ad9ad33bf72e 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -4,6 +4,7 @@ "xpack.actions": "plugins/actions", "xpack.uiActionsEnhanced": ["plugins/ui_actions_enhanced", "examples/ui_actions_enhanced_examples"], "xpack.alerts": "plugins/alerts", + "xpack.eventLog": "plugins/event_log", "xpack.alertingBuiltins": "plugins/alerting_builtins", "xpack.apm": ["legacy/plugins/apm", "plugins/apm"], "xpack.beatsManagement": ["legacy/plugins/beats_management", "plugins/beats_management"], diff --git a/x-pack/package.json b/x-pack/package.json index 7533741391f8e4..b426e790c2d47d 100644 --- a/x-pack/package.json +++ b/x-pack/package.json @@ -131,7 +131,7 @@ "base64-js": "^1.3.1", "base64url": "^3.0.1", "canvas": "^2.6.1", - "chalk": "^2.4.2", + "chalk": "^4.1.0", "chance": "1.0.18", "cheerio": "0.22.0", "commander": "3.0.2", @@ -217,7 +217,7 @@ "@kbn/interpreter": "1.0.0", "@kbn/ui-framework": "1.0.0", "@mapbox/geojson-rewind": "^0.4.1", - "@mapbox/mapbox-gl-draw": "^1.1.2", + "@mapbox/mapbox-gl-draw": "^1.2.0", "@mapbox/mapbox-gl-rtl-text": "^0.2.3", "@scant/router": "^0.1.0", "@slack/webhook": "^5.0.0", @@ -397,4 +397,4 @@ "cypress-multi-reporters" ] } -} \ No newline at end of file +} diff --git a/x-pack/plugins/actions/server/plugin.ts b/x-pack/plugins/actions/server/plugin.ts index 54d137cc0f617e..ee50ee81d507cb 100644 --- a/x-pack/plugins/actions/server/plugin.ts +++ b/x-pack/plugins/actions/server/plugin.ts @@ -123,6 +123,7 @@ export class ActionsPlugin implements Plugin, Plugi private licenseState: ILicenseState | null = null; private spaces?: SpacesServiceSetup; private security?: SecurityPluginSetup; + private eventLogService?: IEventLogService; private eventLogger?: IEventLogger; private isESOUsingEphemeralEncryptionKey?: boolean; private readonly telemetryLogger: Logger; @@ -160,6 +161,7 @@ export class ActionsPlugin implements Plugin, Plugi plugins.features.registerFeature(ACTIONS_FEATURE); setupSavedObjects(core.savedObjects, plugins.encryptedSavedObjects); + this.eventLogService = plugins.eventLog; plugins.eventLog.registerProviderActions(EVENT_LOG_PROVIDER, Object.values(EVENT_LOG_ACTIONS)); this.eventLogger = plugins.eventLog.getLogger({ event: { provider: EVENT_LOG_PROVIDER }, @@ -295,6 +297,11 @@ export class ActionsPlugin implements Plugin, Plugi }); }; + this.eventLogService!.registerSavedObjectProvider('action', (request) => { + const client = getActionsClientWithRequest(request); + return async (type: string, id: string) => (await client).get({ id }); + }); + const getScopedSavedObjectsClientWithoutAccessToActions = (request: KibanaRequest) => core.savedObjects.getScopedClient(request); diff --git a/x-pack/plugins/alerts/server/plugin.ts b/x-pack/plugins/alerts/server/plugin.ts index 2f0df441975538..5d69887bd5bf0a 100644 --- a/x-pack/plugins/alerts/server/plugin.ts +++ b/x-pack/plugins/alerts/server/plugin.ts @@ -106,6 +106,7 @@ export class AlertingPlugin { private readonly alertsClientFactory: AlertsClientFactory; private readonly telemetryLogger: Logger; private readonly kibanaIndex: Promise; + private eventLogService?: IEventLogService; private eventLogger?: IEventLogger; constructor(initializerContext: PluginInitializerContext) { @@ -150,6 +151,7 @@ export class AlertingPlugin { setupSavedObjects(core.savedObjects, plugins.encryptedSavedObjects); + this.eventLogService = plugins.eventLog; plugins.eventLog.registerProviderActions(EVENT_LOG_PROVIDER, Object.values(EVENT_LOG_ACTIONS)); this.eventLogger = plugins.eventLog.getLogger({ event: { provider: EVENT_LOG_PROVIDER }, @@ -255,6 +257,11 @@ export class AlertingPlugin { eventLogger: this.eventLogger!, }); + this.eventLogService!.registerSavedObjectProvider('alert', (request) => { + const client = getAlertsClientWithRequest(request); + return (type: string, id: string) => client.get({ id }); + }); + scheduleAlertingTelemetry(this.telemetryLogger, plugins.taskManager); return { diff --git a/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/Distribution/index.tsx b/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/Distribution/index.tsx index 80c749e58c88c7..ecdd52e31730c8 100644 --- a/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/Distribution/index.tsx +++ b/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/Distribution/index.tsx @@ -107,7 +107,8 @@ export function ErrorDistribution({ distribution, title }: Props) { } formatYLong={(value: number) => i18n.translate('xpack.apm.errorGroupDetails.occurrencesLongLabel', { - defaultMessage: '{occCount} occurrences', + defaultMessage: + '{occCount} {occCount, plural, one {occurrence} other {occurrences}}', values: { occCount: value }, }) } diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/browser/markdown.ts b/x-pack/plugins/canvas/canvas_plugin_src/functions/browser/markdown.ts index e44fb903ef042a..947106fd9397a5 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/browser/markdown.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/browser/markdown.ts @@ -22,7 +22,7 @@ interface Arguments { openLinksInNewTab: boolean; } -interface Return { +export interface Return { content: string; font: Style; openLinksInNewTab: boolean; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/containerStyle.ts b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/containerStyle.ts index 09ce2b2bf17558..93e4a3636b9149 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/containerStyle.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/containerStyle.ts @@ -6,7 +6,6 @@ import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { ContainerStyle, Overflow, BackgroundRepeat, BackgroundSize } from '../../../types'; import { getFunctionHelp, getFunctionErrors } from '../../../i18n'; -// @ts-expect-error untyped local import { isValidUrl } from '../../../common/lib/url'; interface Output extends ContainerStyle { diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/image.ts b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/image.ts index 3ef956b41ce20b..21157660ed414a 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/image.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/image.ts @@ -8,7 +8,6 @@ import { getFunctionHelp, getFunctionErrors } from '../../../i18n'; // @ts-expect-error untyped local import { resolveWithMissingImage } from '../../../common/lib/resolve_dataurl'; -// @ts-expect-error .png file import { elasticLogo } from '../../lib/elastic_logo'; export enum ImageMode { @@ -22,7 +21,7 @@ interface Arguments { mode: ImageMode | null; } -interface Return { +export interface Return { type: 'image'; mode: string; dataurl: string; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/index.ts b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/index.ts index 79538941bbbfa9..5ec831efbe35f1 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/index.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/index.ts @@ -46,7 +46,7 @@ import { render } from './render'; import { replace } from './replace'; import { rounddate } from './rounddate'; import { rowCount } from './rowCount'; -import { repeatImage } from './repeatImage'; +import { repeatImage } from './repeat_image'; import { revealImage } from './revealImage'; import { seriesStyle } from './seriesStyle'; import { shape } from './shape'; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/pie.ts b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/pie.ts index c32c553fffc1bc..16eee349475ef6 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/pie.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/pie.ts @@ -57,7 +57,7 @@ interface PieData { color?: string; } -interface Pie { +export interface Pie { font: Style; data: PieData[]; options: PieOptions; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/progress.ts b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/progress.ts index 6fc1e509cd5e64..4c4dba3ef7a3b8 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/progress.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/progress.ts @@ -20,7 +20,7 @@ export enum Shape { WHEEL = 'wheel', } -interface Arguments { +export interface Arguments { barColor: string; barWeight: number; font: Style; @@ -31,6 +31,10 @@ interface Arguments { valueWeight: number; } +export type Output = Arguments & { + value: number; +}; + export function progress(): ExpressionFunctionDefinition< 'progress', number, diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/repeat_image.test.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/repeat_image.test.js index 723c5eb4c68230..f7c1ecc94a2404 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/repeat_image.test.js +++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/repeat_image.test.js @@ -7,7 +7,7 @@ import { functionWrapper } from '../../../__tests__/helpers/function_wrapper'; import { elasticOutline } from '../../lib/elastic_outline'; import { elasticLogo } from '../../lib/elastic_logo'; -import { repeatImage } from './repeatImage'; +import { repeatImage } from './repeat_image'; describe('repeatImage', () => { const fn = functionWrapper(repeatImage); diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/repeatImage.ts b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/repeat_image.ts similarity index 93% rename from x-pack/plugins/canvas/canvas_plugin_src/functions/common/repeatImage.ts rename to x-pack/plugins/canvas/canvas_plugin_src/functions/common/repeat_image.ts index 9e296f2b9a92a8..cbb118c0db807d 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/repeatImage.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/repeat_image.ts @@ -7,7 +7,6 @@ import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; // @ts-expect-error untyped local import { resolveWithMissingImage } from '../../../common/lib/resolve_dataurl'; -// @ts-expect-error .png file import { elasticOutline } from '../../lib/elastic_outline'; import { Render } from '../../../types'; import { getFunctionHelp } from '../../../i18n'; @@ -19,6 +18,14 @@ interface Arguments { emptyImage: string | null; } +export interface Return { + count: number; + image: string; + size: number; + max: number; + emptyImage: string | null; +} + export function repeatImage(): ExpressionFunctionDefinition< 'repeatImage', number, diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/revealImage.ts b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/revealImage.ts index 3e721cc49b4111..9288a417f9d29f 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/revealImage.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/revealImage.ts @@ -7,7 +7,6 @@ import { ExpressionFunctionDefinition, ExpressionValueRender } from 'src/plugins/expressions'; // @ts-expect-error untyped local import { resolveWithMissingImage } from '../../../common/lib/resolve_dataurl'; -// @ts-expect-error .png file import { elasticOutline } from '../../lib/elastic_outline'; import { getFunctionHelp, getFunctionErrors } from '../../../i18n'; @@ -24,11 +23,18 @@ interface Arguments { origin: Origin; } +export interface Output { + image: string; + emptyImage: string; + origin: Origin; + percent: number; +} + export function revealImage(): ExpressionFunctionDefinition< 'revealImage', number, Arguments, - ExpressionValueRender + ExpressionValueRender > { const { help, args: argHelp } = getFunctionHelp().revealImage; const errors = getFunctionErrors().revealImage; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/shape.ts b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/shape.ts index a3fedebd36cfe2..e7178ab4eef5b9 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/shape.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/shape.ts @@ -34,7 +34,7 @@ interface Arguments { maintainAspect: boolean; } -interface Output extends Arguments { +export interface Output extends Arguments { type: 'shape'; } diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/table.ts b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/table.ts index 689f3f969d1c86..744d426d3bc6cb 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/table.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/table.ts @@ -15,11 +15,13 @@ interface Arguments { showHeader: boolean; } +export type Return = { datatable: Datatable } & Arguments; + export function table(): ExpressionFunctionDefinition< 'table', Datatable, Arguments, - Render + Render > { const { help, args: argHelp } = getFunctionHelp().table; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/lib/elastic_logo.js b/x-pack/plugins/canvas/canvas_plugin_src/lib/elastic_logo.ts similarity index 100% rename from x-pack/plugins/canvas/canvas_plugin_src/lib/elastic_logo.js rename to x-pack/plugins/canvas/canvas_plugin_src/lib/elastic_logo.ts diff --git a/x-pack/plugins/canvas/canvas_plugin_src/lib/elastic_outline.js b/x-pack/plugins/canvas/canvas_plugin_src/lib/elastic_outline.ts similarity index 100% rename from x-pack/plugins/canvas/canvas_plugin_src/lib/elastic_outline.js rename to x-pack/plugins/canvas/canvas_plugin_src/lib/elastic_outline.ts diff --git a/x-pack/plugins/canvas/canvas_plugin_src/plugin.ts b/x-pack/plugins/canvas/canvas_plugin_src/plugin.ts index 59f0287805eac4..55f5319bbadb7c 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/plugin.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/plugin.ts @@ -12,7 +12,6 @@ import { Start as InspectorStart } from '../../../../src/plugins/inspector/publi import { functions } from './functions/browser'; import { typeFunctions } from './expression_types'; -// @ts-expect-error: untyped local import { renderFunctions, renderFunctionFactories } from './renderers'; import { initializeElements } from './elements'; // @ts-expect-error untyped local diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/core.js b/x-pack/plugins/canvas/canvas_plugin_src/renderers/core.ts similarity index 100% rename from x-pack/plugins/canvas/canvas_plugin_src/renderers/core.js rename to x-pack/plugins/canvas/canvas_plugin_src/renderers/core.ts diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/debug.js b/x-pack/plugins/canvas/canvas_plugin_src/renderers/debug.tsx similarity index 91% rename from x-pack/plugins/canvas/canvas_plugin_src/renderers/debug.js rename to x-pack/plugins/canvas/canvas_plugin_src/renderers/debug.tsx index 79ec0078fa98a0..b4fbba96e8dfb4 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/debug.js +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/debug.tsx @@ -8,10 +8,11 @@ import ReactDOM from 'react-dom'; import React from 'react'; import { Debug } from '../../public/components/debug'; import { RendererStrings } from '../../i18n'; +import { RendererFactory } from '../../types'; const { debug: strings } = RendererStrings; -export const debug = () => ({ +export const debug: RendererFactory = () => ({ name: 'debug', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx b/x-pack/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx index ad368a912cd8cc..641580d9c58a54 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx @@ -17,7 +17,7 @@ import { EmbeddableExpression } from '../../expression_types/embeddable'; import { RendererStrings } from '../../../i18n'; import { embeddableInputToExpression } from './embeddable_input_to_expression'; import { EmbeddableInput } from '../../expression_types'; -import { RendererHandlers } from '../../../types'; +import { RendererFactory } from '../../../types'; import { CANVAS_EMBEDDABLE_CLASSNAME } from '../../../common/lib'; const { embeddable: strings } = RendererStrings; @@ -43,18 +43,17 @@ const renderEmbeddableFactory = (core: CoreStart, plugins: StartDeps) => { }; }; -export const embeddableRendererFactory = (core: CoreStart, plugins: StartDeps) => { +export const embeddableRendererFactory = ( + core: CoreStart, + plugins: StartDeps +): RendererFactory> => { const renderEmbeddable = renderEmbeddableFactory(core, plugins); return () => ({ name: 'embeddable', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), reuseDomNode: true, - render: async ( - domNode: HTMLElement, - { input, embeddableType }: EmbeddableExpression, - handlers: RendererHandlers - ) => { + render: async (domNode, { input, embeddableType }, handlers) => { const uniqueId = handlers.getElementId(); if (!embeddablesRegistry[uniqueId]) { diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/error/index.js b/x-pack/plugins/canvas/canvas_plugin_src/renderers/error/index.tsx similarity index 84% rename from x-pack/plugins/canvas/canvas_plugin_src/renderers/error/index.js rename to x-pack/plugins/canvas/canvas_plugin_src/renderers/error/index.tsx index b7e3fc300a189f..a9296bd9a12417 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/error/index.js +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/error/index.tsx @@ -5,15 +5,20 @@ */ import ReactDOM from 'react-dom'; -import React from 'react'; +import React, { MouseEventHandler } from 'react'; import { EuiIcon } from '@elastic/eui'; import { Error } from '../../../public/components/error'; import { Popover } from '../../../public/components/popover'; import { RendererStrings } from '../../../i18n'; +import { RendererFactory } from '../../../types'; + +interface Config { + error: Error; +} const { error: strings } = RendererStrings; -export const error = () => ({ +export const error: RendererFactory = () => ({ name: 'error', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), @@ -21,7 +26,7 @@ export const error = () => ({ render(domNode, config, handlers) { const draw = () => { const buttonSize = Math.min(domNode.clientHeight, domNode.clientWidth); - const button = (handleClick) => ( + const button = (handleClick: MouseEventHandler) => ( ({ +export const advancedFilter: RendererFactory<{}> = () => ({ name: 'advanced_filter', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/index.js b/x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/index.ts similarity index 100% rename from x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/index.js rename to x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/index.ts diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/image.js b/x-pack/plugins/canvas/canvas_plugin_src/renderers/image.tsx similarity index 86% rename from x-pack/plugins/canvas/canvas_plugin_src/renderers/image.js rename to x-pack/plugins/canvas/canvas_plugin_src/renderers/image.tsx index fd76f0106f7d54..cbd81f0143da87 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/image.js +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/image.tsx @@ -8,11 +8,13 @@ import ReactDOM from 'react-dom'; import React from 'react'; import { elasticLogo } from '../lib/elastic_logo'; import { isValidUrl } from '../../common/lib/url'; +import { Return as Arguments } from '../functions/common/image'; import { RendererStrings } from '../../i18n'; +import { RendererFactory } from '../../types'; const { image: strings } = RendererStrings; -export const image = () => ({ +export const image: RendererFactory = () => ({ name: 'image', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/index.js b/x-pack/plugins/canvas/canvas_plugin_src/renderers/index.ts similarity index 100% rename from x-pack/plugins/canvas/canvas_plugin_src/renderers/index.js rename to x-pack/plugins/canvas/canvas_plugin_src/renderers/index.ts diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/markdown/index.js b/x-pack/plugins/canvas/canvas_plugin_src/renderers/markdown/index.tsx similarity index 78% rename from x-pack/plugins/canvas/canvas_plugin_src/renderers/markdown/index.js rename to x-pack/plugins/canvas/canvas_plugin_src/renderers/markdown/index.tsx index a7b0f620cf7100..1ce05b77a51099 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/markdown/index.js +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/markdown/index.tsx @@ -4,14 +4,16 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import React, { CSSProperties } from 'react'; import ReactDOM from 'react-dom'; import { RendererStrings } from '../../../i18n'; +import { Return as Config } from '../../functions/browser/markdown'; import { Markdown } from '../../../../../../src/plugins/kibana_react/public'; +import { RendererFactory } from '../../../types'; const { markdown: strings } = RendererStrings; -export const markdown = () => ({ +export const markdown: RendererFactory = () => ({ name: 'markdown', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), @@ -22,7 +24,7 @@ export const markdown = () => ({ ReactDOM.render( , diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/pie/index.js b/x-pack/plugins/canvas/canvas_plugin_src/renderers/pie/index.tsx similarity index 74% rename from x-pack/plugins/canvas/canvas_plugin_src/renderers/pie/index.js rename to x-pack/plugins/canvas/canvas_plugin_src/renderers/pie/index.tsx index cb423af30094c4..622e73ccf2223e 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/pie/index.js +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/pie/index.tsx @@ -10,11 +10,14 @@ import '../../lib/flot-charts'; import { debounce, includes } from 'lodash'; import { RendererStrings } from '../../../i18n'; +// @ts-expect-error Untyped local: Will not convert import { pie as piePlugin } from './plugins/pie'; +import { Pie } from '../../functions/common/pie'; +import { RendererFactory } from '../../../types'; const { pie: strings } = RendererStrings; -export const pie = () => ({ +export const pie: RendererFactory = () => ({ name: 'pie', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), @@ -27,7 +30,10 @@ export const pie = () => ({ config.options.legend.labelBoxBorderColor = 'transparent'; if (config.font) { - const labelFormatter = (label, slice) => { + const labelFormatter = ( + label: string, + slice: jquery.flot.dataSeries & { percent: number } + ) => { // font color defaults to slice color if not specified const fontSpec = { ...config.font.spec, color: config.font.spec.color || slice.color }; const labelDiv = document.createElement('div'); @@ -36,23 +42,28 @@ export const pie = () => ({ const lineBreak = document.createElement('br'); const percentText = document.createTextNode(`${Math.round(slice.percent)}%`); - labelDiv.appendChild(labelSpan); + if (labelSpan) { + labelDiv.appendChild(labelSpan); + } labelDiv.appendChild(lineBreak); labelDiv.appendChild(percentText); return labelDiv.outerHTML; }; + // @ts-ignore ignoring missing propery config.options.series.pie.label.formatter = labelFormatter; - const legendFormatter = (label) => { + const legendFormatter = (label: string) => { const labelSpan = document.createElement('span'); Object.assign(labelSpan.style, config.font.spec); labelSpan.textContent = label; return labelSpan.outerHTML; }; + // @ts-ignore ignoring missing propery config.options.legend.labelFormatter = legendFormatter; } - let plot; + let plot: jquery.flot.plot; + function draw() { if (domNode.clientHeight < 1 || domNode.clientWidth < 1) { return; @@ -63,10 +74,11 @@ export const pie = () => ({ if (!config.data || !config.data.length) { $(domNode).empty(); } else { - plot = $.plot($(domNode), config.data, config.options); + // Casting config.options to any here as the flot typings do not appear to be accurate. + // For example, it does not have colors as a valid option. + plot = $.plot($(domNode), config.data, config.options as any); } } catch (e) { - console.log(e); // Nope } } diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/plot/index.js b/x-pack/plugins/canvas/canvas_plugin_src/renderers/plot/index.ts similarity index 82% rename from x-pack/plugins/canvas/canvas_plugin_src/renderers/plot/index.js rename to x-pack/plugins/canvas/canvas_plugin_src/renderers/plot/index.ts index ab523f1526e16a..8c84f54f8746be 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/plot/index.js +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/plot/index.ts @@ -10,12 +10,15 @@ import '../../lib/flot-charts'; import { debounce, includes } from 'lodash'; import { RendererStrings } from '../../../i18n'; +import { RendererFactory, RendererSpec } from '../../../types'; +// @ts-expect-error Not going to convert import { size } from './plugins/size'; +// @ts-expect-error Not going to convert import { text } from './plugins/text'; const { plot: strings } = RendererStrings; -const render = (domNode, config, handlers) => { +const render: RendererSpec['render'] = (domNode, config, handlers) => { // TODO: OH NOES if (!includes($.plot.plugins, size)) { $.plot.plugins.push(size); @@ -24,14 +27,14 @@ const render = (domNode, config, handlers) => { $.plot.plugins.push(text); } - let plot; + let plot: jquery.flot.plot; function draw() { if (domNode.clientHeight < 1 || domNode.clientWidth < 1) { return; } if (config.font) { - const legendFormatter = (label) => { + const legendFormatter = (label: string) => { const labelSpan = document.createElement('span'); Object.assign(labelSpan.style, config.font.spec); labelSpan.textContent = label; @@ -67,9 +70,10 @@ const render = (domNode, config, handlers) => { return handlers.done(); }; -export const plot = () => ({ +export const plot: RendererFactory = () => ({ name: 'plot', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), + reuseDomNode: false, render, }); diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/index.js b/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/index.ts similarity index 64% rename from x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/index.js rename to x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/index.ts index 67d0abb65837d2..ea57655c230b94 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/index.js +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/index.ts @@ -7,10 +7,12 @@ import { getId } from '../../../public/lib/get_id'; import { RendererStrings } from '../../../i18n'; import { shapes } from './shapes'; +import { Output as Arguments } from '../../functions/common/progress'; +import { RendererFactory } from '../../../types'; const { progress: strings } = RendererStrings; -export const progress = () => ({ +export const progress: RendererFactory = () => ({ name: 'progress', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), @@ -23,12 +25,13 @@ export const progress = () => ({ if (shapeDef) { const parser = new DOMParser(); - const [shapeSvg] = parser - .parseFromString(shapes[shape], 'image/svg+xml') - .getElementsByTagName('svg'); + const shapeSvg = parser + .parseFromString(shapeDef, 'image/svg+xml') + .getElementsByTagName('svg') + .item(0)!; const initialViewBox = shapeSvg - .getAttribute('viewBox') + .getAttribute('viewBox')! .split(' ') .map((v) => parseInt(v, 10)); let [minX, minY, width, height] = initialViewBox; @@ -51,35 +54,35 @@ export const progress = () => ({ const svgId = getId('svg'); shapeSvg.id = svgId; - const [bar] = shapeSvg.getElementsByTagName('path'); + const bar = shapeSvg.getElementsByTagName('path').item(0)!; bar.setAttribute('className', 'canvasProgress__background'); bar.setAttribute('fill', 'none'); bar.setAttribute('stroke', barColor); bar.setAttribute('stroke-width', `${barWeight}px`); - const value = bar.cloneNode(true); - value.setAttribute('className', 'canvasProgress__value'); - value.setAttribute('stroke', valueColor); - value.setAttribute('stroke-width', `${valueWeight}px`); + const valueSvg = bar.cloneNode(true) as SVGPathElement; + valueSvg.setAttribute('className', 'canvasProgress__value'); + valueSvg.setAttribute('stroke', valueColor); + valueSvg.setAttribute('stroke-width', `${valueWeight}px`); - const length = value.getTotalLength(); + const length = valueSvg.getTotalLength(); const to = length * (1 - percent); - value.setAttribute('stroke-dasharray', length); - value.setAttribute('stroke-dashoffset', Math.max(0, to)); + valueSvg.setAttribute('stroke-dasharray', String(length)); + valueSvg.setAttribute('stroke-dashoffset', String(Math.max(0, to))); - shapeSvg.appendChild(value); + shapeSvg.appendChild(valueSvg); - const [text] = shapeSvg.getElementsByTagName('text'); + const text = shapeSvg.getElementsByTagName('text').item(0); if (label && text) { - text.textContent = label; + text.textContent = String(label); text.setAttribute('className', 'canvasProgress__label'); if (shape === 'horizontalPill') { - text.setAttribute('x', parseInt(text.getAttribute('x'), 10) + offset / 2); + text.setAttribute('x', String(parseInt(text.getAttribute('x')!, 10) + offset / 2)); } if (shape === 'verticalPill') { - text.setAttribute('y', parseInt(text.getAttribute('y'), 10) - offset / 2); + text.setAttribute('y', String(parseInt(text.getAttribute('y')!, 10) - offset / 2)); } Object.assign(text.style, font.spec); @@ -89,7 +92,7 @@ export const progress = () => ({ const { width: labelWidth, height: labelHeight } = text.getBBox(); if (shape === 'horizontalBar' || shape === 'horizontalPill') { - text.setAttribute('x', parseInt(text.getAttribute('x'), 10)); + text.setAttribute('x', String(parseInt(text.getAttribute('x')!, 10))); width += labelWidth; } if (shape === 'verticalBar' || shape === 'verticalPill') { @@ -103,8 +106,8 @@ export const progress = () => ({ } shapeSvg.setAttribute('viewBox', [minX, minY, width, height].join(' ')); - shapeSvg.setAttribute('width', domNode.offsetWidth); - shapeSvg.setAttribute('height', domNode.offsetHeight); + shapeSvg.setAttribute('width', String(domNode.offsetWidth)); + shapeSvg.setAttribute('height', String(domNode.offsetHeight)); if (domNode.firstChild) { domNode.removeChild(domNode.firstChild); @@ -112,8 +115,8 @@ export const progress = () => ({ domNode.appendChild(shapeSvg); handlers.onResize(() => { - shapeSvg.setAttribute('width', domNode.offsetWidth); - shapeSvg.setAttribute('height', domNode.offsetHeight); + shapeSvg.setAttribute('width', String(domNode.offsetWidth)); + shapeSvg.setAttribute('height', String(domNode.offsetHeight)); }); } diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/index.js b/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/index.ts similarity index 100% rename from x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/index.js rename to x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/index.ts diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/repeat_image.js b/x-pack/plugins/canvas/canvas_plugin_src/renderers/repeat_image.ts similarity index 81% rename from x-pack/plugins/canvas/canvas_plugin_src/renderers/repeat_image.js rename to x-pack/plugins/canvas/canvas_plugin_src/renderers/repeat_image.ts index 2e48c8a2d5ec32..ff37ca7a0e3dd8 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/repeat_image.js +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/repeat_image.ts @@ -9,25 +9,27 @@ import { times } from 'lodash'; import { elasticOutline } from '../lib/elastic_outline'; import { isValidUrl } from '../../common/lib/url'; import { RendererStrings, ErrorStrings } from '../../i18n'; +import { Return as Arguments } from '../functions/common/repeat_image'; +import { RendererFactory } from '../../types'; const { repeatImage: strings } = RendererStrings; const { RepeatImage: errors } = ErrorStrings; -export const repeatImage = () => ({ +export const repeatImage: RendererFactory = () => ({ name: 'repeatImage', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), reuseDomNode: true, render(domNode, config, handlers) { const settings = { - count: 10, ...config, image: isValidUrl(config.image) ? config.image : elasticOutline, + emptyImage: config.emptyImage || '', }; const container = $('
'); - function setSize(img) { + function setSize(img: HTMLImageElement) { if (img.naturalHeight > img.naturalWidth) { img.height = settings.size; } else { @@ -36,7 +38,7 @@ export const repeatImage = () => ({ } function finish() { - $(domNode).html(container); + $(domNode).append(container); handlers.done(); } @@ -46,7 +48,7 @@ export const repeatImage = () => ({ if (settings.max && settings.count > settings.max) { settings.count = settings.max; } - times(settings.count, () => container.append(img.cloneNode(true))); + times(settings.count, () => container.append($(img).clone())); if (isValidUrl(settings.emptyImage)) { if (settings.max == null) { @@ -56,7 +58,7 @@ export const repeatImage = () => ({ const emptyImage = new Image(); emptyImage.onload = function () { setSize(emptyImage); - times(settings.max - settings.count, () => container.append(emptyImage.cloneNode(true))); + times(settings.max - settings.count, () => container.append($(emptyImage).clone())); finish(); }; emptyImage.src = settings.emptyImage; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/reveal_image/index.js b/x-pack/plugins/canvas/canvas_plugin_src/renderers/reveal_image/index.ts similarity index 80% rename from x-pack/plugins/canvas/canvas_plugin_src/renderers/reveal_image/index.js rename to x-pack/plugins/canvas/canvas_plugin_src/renderers/reveal_image/index.ts index 96c8d80794c0c8..c52556f8564c17 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/reveal_image/index.js +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/reveal_image/index.ts @@ -7,10 +7,12 @@ import { elasticOutline } from '../../lib/elastic_outline'; import { isValidUrl } from '../../../common/lib/url'; import { RendererStrings } from '../../../i18n'; +import { RendererFactory } from '../../../types'; +import { Output as Arguments } from '../../functions/common/revealImage'; const { revealImage: strings } = RendererStrings; -export const revealImage = () => ({ +export const revealImage: RendererFactory = () => ({ name: 'revealImage', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), @@ -23,16 +25,17 @@ export const revealImage = () => ({ domNode.className = 'revealImage'; // set up the overlay image - img.onload = function () { + function onLoad() { setSize(); finish(); - }; + } + img.onload = onLoad; img.className = 'revealImage__image'; img.style.clipPath = getClipPath(config.percent, config.origin); - img.style['-webkit-clip-path'] = getClipPath(config.percent, config.origin); + img.style.setProperty('-webkit-clip-path', getClipPath(config.percent, config.origin)); img.src = isValidUrl(config.image) ? config.image : elasticOutline; - handlers.onResize(img.onload); + handlers.onResize(onLoad); // set up the underlay, "empty" image aligner.className = 'revealImageAligner'; @@ -52,9 +55,9 @@ export const revealImage = () => ({ handlers.done(); } - function getClipPath(percent, origin = 'bottom') { - const directions = { bottom: 0, left: 1, top: 2, right: 3 }; - const values = [0, 0, 0, 0]; + function getClipPath(percent: number, origin = 'bottom') { + const directions: Record = { bottom: 0, left: 1, top: 2, right: 3 }; + const values: Array = [0, 0, 0, 0]; values[directions[origin]] = `${100 - percent * 100}%`; return `inset(${values.join(' ')})`; } diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/shape/index.js b/x-pack/plugins/canvas/canvas_plugin_src/renderers/shape/index.ts similarity index 73% rename from x-pack/plugins/canvas/canvas_plugin_src/renderers/shape/index.js rename to x-pack/plugins/canvas/canvas_plugin_src/renderers/shape/index.ts index 5684c8c4602b5b..7c61ff69b18e08 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/shape/index.js +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/shape/index.ts @@ -6,22 +6,26 @@ import { RendererStrings } from '../../../i18n'; import { shapes } from './shapes'; +import { RendererFactory } from '../../../types'; +import { Output } from '../../functions/common/shape'; const { shape: strings } = RendererStrings; -export const shape = () => ({ +export const shape: RendererFactory = () => ({ name: 'shape', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), reuseDomNode: true, render(domNode, config, handlers) { - const { shape, fill, border, borderWidth, maintainAspect } = config; + const { shape: shapeType, fill, border, borderWidth, maintainAspect } = config; + const parser = new DOMParser(); - const [shapeSvg] = parser - .parseFromString(shapes[shape], 'image/svg+xml') - .getElementsByTagName('svg'); + const shapeSvg = parser + .parseFromString(shapes[shapeType], 'image/svg+xml') + .getElementsByTagName('svg') + .item(0)!; - const shapeContent = shapeSvg.firstElementChild; + const shapeContent = shapeSvg.firstElementChild!; if (fill) { shapeContent.setAttribute('fill', fill); @@ -30,15 +34,15 @@ export const shape = () => ({ shapeContent.setAttribute('stroke', border); } const strokeWidth = Math.max(borderWidth, 0); - shapeContent.setAttribute('stroke-width', strokeWidth); - shapeContent.setAttribute('stroke-miterlimit', 999); + shapeContent.setAttribute('stroke-width', String(strokeWidth)); + shapeContent.setAttribute('stroke-miterlimit', '999'); shapeContent.setAttribute('vector-effect', 'non-scaling-stroke'); shapeSvg.setAttribute('preserveAspectRatio', maintainAspect ? 'xMidYMid meet' : 'none'); shapeSvg.setAttribute('overflow', 'visible'); const initialViewBox = shapeSvg - .getAttribute('viewBox') + .getAttribute('viewBox')! .split(' ') .map((v) => parseInt(v, 10)); @@ -66,8 +70,8 @@ export const shape = () => ({ shapeHeight = 0; } - shapeSvg.setAttribute('width', width); - shapeSvg.setAttribute('height', height); + shapeSvg.setAttribute('width', String(width)); + shapeSvg.setAttribute('height', String(height)); shapeSvg.setAttribute('viewBox', [minX, minY, shapeWidth, shapeHeight].join(' ')); const oldShape = domNode.firstElementChild; @@ -75,7 +79,7 @@ export const shape = () => ({ domNode.removeChild(oldShape); } - domNode.style.lineHeight = 0; + domNode.style.lineHeight = '0'; domNode.appendChild(shapeSvg); }; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/table.js b/x-pack/plugins/canvas/canvas_plugin_src/renderers/table.tsx similarity index 61% rename from x-pack/plugins/canvas/canvas_plugin_src/renderers/table.js rename to x-pack/plugins/canvas/canvas_plugin_src/renderers/table.tsx index 971ba577643ed4..ada159e07f6ae9 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/table.js +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/table.tsx @@ -6,22 +6,30 @@ import ReactDOM from 'react-dom'; import React from 'react'; -import { get } from 'lodash'; -import { Datatable } from '../../public/components/datatable'; +import { Datatable as DatatableComponent } from '../../public/components/datatable'; import { RendererStrings } from '../../i18n'; +import { RendererFactory, Style, Datatable } from '../../types'; const { dropdownFilter: strings } = RendererStrings; -export const table = () => ({ +interface TableArguments { + font?: Style; + paginate: boolean; + perPage: number; + showHeader: boolean; + datatable: Datatable; +} + +export const table: RendererFactory = () => ({ name: 'table', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), reuseDomNode: true, render(domNode, config, handlers) { - const { datatable, paginate, perPage, font, showHeader } = config; + const { datatable, paginate, perPage, font = { spec: {} }, showHeader } = config; ReactDOM.render( -
- + ({ +export const text: RendererFactory<{ text: string }> = () => ({ name: 'text', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), reuseDomNode: true, - render(domNode, { text }, handlers) { - ReactDOM.render(
{text}
, domNode, () => handlers.done()); + render(domNode, { text: textString }, handlers) { + ReactDOM.render(
{textString}
, domNode, () => handlers.done()); handlers.onDestroy(() => ReactDOM.unmountComponentAtNode(domNode)); }, }); diff --git a/x-pack/plugins/canvas/common/lib/index.ts b/x-pack/plugins/canvas/common/lib/index.ts index 6bd7e0bc9948fd..055f6ce7739b7d 100644 --- a/x-pack/plugins/canvas/common/lib/index.ts +++ b/x-pack/plugins/canvas/common/lib/index.ts @@ -24,12 +24,10 @@ export * from './get_legend_config'; export * from './handlebars'; export * from './hex_to_rgb'; export * from './httpurl'; -// @ts-expect-error missing local definition export * from './missing_asset'; export * from './palettes'; export * from './pivot_object_array'; // @ts-expect-error missing local definition export * from './resolve_dataurl'; export * from './unquote_string'; -// @ts-expect-error missing local definition export * from './url'; diff --git a/x-pack/plugins/canvas/common/lib/missing_asset.js b/x-pack/plugins/canvas/common/lib/missing_asset.ts similarity index 100% rename from x-pack/plugins/canvas/common/lib/missing_asset.js rename to x-pack/plugins/canvas/common/lib/missing_asset.ts diff --git a/x-pack/plugins/canvas/common/lib/url.test.js b/x-pack/plugins/canvas/common/lib/url.test.ts similarity index 100% rename from x-pack/plugins/canvas/common/lib/url.test.js rename to x-pack/plugins/canvas/common/lib/url.test.ts diff --git a/x-pack/plugins/canvas/common/lib/url.js b/x-pack/plugins/canvas/common/lib/url.ts similarity index 90% rename from x-pack/plugins/canvas/common/lib/url.js rename to x-pack/plugins/canvas/common/lib/url.ts index bed5e30cbff3be..d2e031159d9693 100644 --- a/x-pack/plugins/canvas/common/lib/url.js +++ b/x-pack/plugins/canvas/common/lib/url.ts @@ -7,6 +7,6 @@ import { isValidDataUrl } from '../../common/lib/dataurl'; import { isValidHttpUrl } from '../../common/lib/httpurl'; -export function isValidUrl(url) { +export function isValidUrl(url: string) { return isValidDataUrl(url) || isValidHttpUrl(url); } diff --git a/x-pack/plugins/canvas/i18n/functions/dict/repeat_image.ts b/x-pack/plugins/canvas/i18n/functions/dict/repeat_image.ts index aafaec11c4d1de..222947779a7586 100644 --- a/x-pack/plugins/canvas/i18n/functions/dict/repeat_image.ts +++ b/x-pack/plugins/canvas/i18n/functions/dict/repeat_image.ts @@ -5,7 +5,7 @@ */ import { i18n } from '@kbn/i18n'; -import { repeatImage } from '../../../canvas_plugin_src/functions/common/repeatImage'; +import { repeatImage } from '../../../canvas_plugin_src/functions/common/repeat_image'; import { FunctionHelp } from '../function_help'; import { FunctionFactory } from '../../../types'; import { CONTEXT, BASE64, URL } from '../../constants'; diff --git a/x-pack/plugins/canvas/public/components/error/error.js b/x-pack/plugins/canvas/public/components/error/error.tsx similarity index 86% rename from x-pack/plugins/canvas/public/components/error/error.js rename to x-pack/plugins/canvas/public/components/error/error.tsx index 2f82e7d669bd59..93650df93cbeb0 100644 --- a/x-pack/plugins/canvas/public/components/error/error.js +++ b/x-pack/plugins/canvas/public/components/error/error.tsx @@ -4,16 +4,22 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import React, { FC } from 'react'; import PropTypes from 'prop-types'; import { EuiCallOut } from '@elastic/eui'; import { get } from 'lodash'; import { ComponentStrings } from '../../../i18n'; import { ShowDebugging } from './show_debugging'; +export interface Props { + payload: { + error: Error; + }; +} + const { Error: strings } = ComponentStrings; -export const Error = ({ payload }) => { +export const Error: FC = ({ payload }) => { const message = get(payload, 'error.message'); return ( diff --git a/x-pack/plugins/canvas/public/components/error/index.js b/x-pack/plugins/canvas/public/components/error/index.ts similarity index 100% rename from x-pack/plugins/canvas/public/components/error/index.js rename to x-pack/plugins/canvas/public/components/error/index.ts diff --git a/x-pack/plugins/canvas/public/components/error/show_debugging.js b/x-pack/plugins/canvas/public/components/error/show_debugging.tsx similarity index 64% rename from x-pack/plugins/canvas/public/components/error/show_debugging.js rename to x-pack/plugins/canvas/public/components/error/show_debugging.tsx index 102ebc3f8a7e8b..0d5d74903828b0 100644 --- a/x-pack/plugins/canvas/public/components/error/show_debugging.js +++ b/x-pack/plugins/canvas/public/components/error/show_debugging.tsx @@ -4,14 +4,16 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import React, { FC, useState } from 'react'; import PropTypes from 'prop-types'; -import { withState } from 'recompose'; import { EuiButtonEmpty } from '@elastic/eui'; import { Debug } from '../debug'; +import { Props } from './error'; -const ShowDebuggingComponent = ({ payload, expanded, setExpanded }) => - process.env.NODE_ENV === 'production' ? null : ( +export const ShowDebugging: FC = ({ payload }) => { + const [expanded, setExpanded] = useState(false); + + return process.env.NODE_ENV === 'production' ? null : (
)}
); +}; -ShowDebuggingComponent.propTypes = { - expanded: PropTypes.bool.isRequired, - setExpanded: PropTypes.func.isRequired, +ShowDebugging.propTypes = { payload: PropTypes.object.isRequired, }; - -export const ShowDebugging = withState('expanded', 'setExpanded', false)(ShowDebuggingComponent); diff --git a/x-pack/plugins/canvas/public/plugin_api.ts b/x-pack/plugins/canvas/public/plugin_api.ts index 4074d240c06e91..62e82df4b0d044 100644 --- a/x-pack/plugins/canvas/public/plugin_api.ts +++ b/x-pack/plugins/canvas/public/plugin_api.ts @@ -6,7 +6,8 @@ import { AnyExpressionFunctionDefinition, AnyExpressionTypeDefinition, - RendererFactory, + AnyExpressionRenderDefinition, + AnyRendererFactory, } from '../types'; import { ElementFactory } from '../types'; import { ExpressionsSetup } from '../../../../src/plugins/expressions/public'; @@ -19,7 +20,7 @@ export interface CanvasApi { addElements: AddToRegistry; addFunctions: AddToRegistry<() => AnyExpressionFunctionDefinition>; addModelUIs: AddToRegistry; - addRenderers: AddToRegistry; + addRenderers: AddToRegistry; addTagUIs: AddToRegistry; addTransformUIs: AddToRegistry; addTransitions: AddToRegistry; @@ -65,8 +66,11 @@ export function getPluginApi( }); }, addRenderers: (renderers) => { - renderers.forEach((r: any) => { - expressionsPluginSetup.registerRenderer(r); + renderers.forEach((r) => { + // There is an issue of the canvas render definition not matching the expression render definition + // due to our handlers needing additional methods. For now, we are going to cast to get to the proper + // type, but we should work with AppArch to figure out how the Handlers can be genericized + expressionsPluginSetup.registerRenderer((r as unknown) as AnyExpressionRenderDefinition); }); }, diff --git a/x-pack/plugins/canvas/public/services/stubs/expressions.ts b/x-pack/plugins/canvas/public/services/stubs/expressions.ts index 26a90670106d0a..ee332e20c4ca35 100644 --- a/x-pack/plugins/canvas/public/services/stubs/expressions.ts +++ b/x-pack/plugins/canvas/public/services/stubs/expressions.ts @@ -4,13 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ +import { AnyExpressionRenderDefinition } from 'src/plugins/expressions'; import { ExpressionsService } from '../'; -import { - plugin, - ExpressionRenderDefinition, -} from '../../../../../../src/plugins/expressions/public'; +import { plugin } from '../../../../../../src/plugins/expressions/public'; import { functions as functionDefinitions } from '../../../canvas_plugin_src/functions/common'; -// @ts-expect-error untyped local import { renderFunctions } from '../../../canvas_plugin_src/renderers/core'; const placeholder = {} as any; @@ -22,6 +19,6 @@ const setup = expressionsPlugin.setup(placeholder, { export const expressionsService: ExpressionsService = setup.fork(); functionDefinitions.forEach((fn) => expressionsService.registerFunction(fn)); -renderFunctions.forEach((fn: ExpressionRenderDefinition) => - expressionsService.registerRenderer(fn) -); +renderFunctions.forEach((fn) => { + expressionsService.registerRenderer((fn as unknown) as AnyExpressionRenderDefinition); +}); diff --git a/x-pack/plugins/canvas/shareable_runtime/components/__stories__/rendered_element.stories.tsx b/x-pack/plugins/canvas/shareable_runtime/components/__stories__/rendered_element.stories.tsx index 899edee7f04816..aba510b8e736a0 100644 --- a/x-pack/plugins/canvas/shareable_runtime/components/__stories__/rendered_element.stories.tsx +++ b/x-pack/plugins/canvas/shareable_runtime/components/__stories__/rendered_element.stories.tsx @@ -7,7 +7,6 @@ import { storiesOf } from '@storybook/react'; import React from 'react'; import { ExampleContext } from '../../test/context_example'; -// @ts-expect-error import { image } from '../../../canvas_plugin_src/renderers/image'; import { sharedWorkpads } from '../../test'; import { RenderedElement, RenderedElementComponent } from '../rendered_element'; diff --git a/x-pack/plugins/canvas/shareable_runtime/components/rendered_element.tsx b/x-pack/plugins/canvas/shareable_runtime/components/rendered_element.tsx index 6bcc0db92f1ccd..2291eff0db0ec3 100644 --- a/x-pack/plugins/canvas/shareable_runtime/components/rendered_element.tsx +++ b/x-pack/plugins/canvas/shareable_runtime/components/rendered_element.tsx @@ -12,7 +12,7 @@ import { Positionable } from '../../public/components/positionable/positionable' import { elementToShape } from '../../public/components/workpad_page/utils'; import { CanvasRenderedElement } from '../types'; import { CanvasShareableContext, useCanvasShareableState } from '../context'; -import { RendererSpec } from '../../types'; +import { AnyRendererSpec } from '../../types'; import { createHandlers } from '../../public/lib/create_handlers'; import css from './rendered_element.module.scss'; @@ -33,7 +33,7 @@ export interface Props { * The Expression function that evaluates the state of the Element and renders * it to the Page. */ - fn: RendererSpec; + fn: AnyRendererSpec; } /** diff --git a/x-pack/plugins/canvas/types/renderers.ts b/x-pack/plugins/canvas/types/renderers.ts index 772a16aa94c605..7dcb94507b6323 100644 --- a/x-pack/plugins/canvas/types/renderers.ts +++ b/x-pack/plugins/canvas/types/renderers.ts @@ -47,3 +47,6 @@ export interface RendererSpec { } export type RendererFactory = () => RendererSpec; + +export type AnyRendererFactory = RendererFactory; +export type AnyRendererSpec = RendererSpec; diff --git a/x-pack/plugins/data_enhanced/common/index.ts b/x-pack/plugins/data_enhanced/common/index.ts index 4d38e5486907c8..1f1cd938c97d1d 100644 --- a/x-pack/plugins/data_enhanced/common/index.ts +++ b/x-pack/plugins/data_enhanced/common/index.ts @@ -4,9 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -export { - EnhancedSearchParams, - IEnhancedEsSearchRequest, - IAsyncSearchRequest, - IAsyncSearchResponse, -} from './search'; +export { EnhancedSearchParams, IEnhancedEsSearchRequest, IAsyncSearchRequest } from './search'; diff --git a/x-pack/plugins/data_enhanced/common/search/index.ts b/x-pack/plugins/data_enhanced/common/search/index.ts index 9137e551adeb2d..129e412a47ccf1 100644 --- a/x-pack/plugins/data_enhanced/common/search/index.ts +++ b/x-pack/plugins/data_enhanced/common/search/index.ts @@ -4,9 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -export { - EnhancedSearchParams, - IEnhancedEsSearchRequest, - IAsyncSearchRequest, - IAsyncSearchResponse, -} from './types'; +export { EnhancedSearchParams, IEnhancedEsSearchRequest, IAsyncSearchRequest } from './types'; diff --git a/x-pack/plugins/data_enhanced/common/search/types.ts b/x-pack/plugins/data_enhanced/common/search/types.ts index c29deee5e4cb31..a5d7d326cecd5b 100644 --- a/x-pack/plugins/data_enhanced/common/search/types.ts +++ b/x-pack/plugins/data_enhanced/common/search/types.ts @@ -4,11 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { - IEsSearchRequest, - IEsSearchResponse, - ISearchRequestParams, -} from '../../../../../src/plugins/data/common'; +import { IEsSearchRequest, ISearchRequestParams } from '../../../../../src/plugins/data/common'; export interface EnhancedSearchParams extends ISearchRequestParams { ignoreThrottled: boolean; @@ -23,17 +19,6 @@ export interface IAsyncSearchRequest extends IEsSearchRequest { params?: EnhancedSearchParams; } -export interface IAsyncSearchResponse extends IEsSearchResponse { - /** - * Indicates whether async search is still in flight - */ - is_running?: boolean; - /** - * Indicates whether the results returned are complete or partial - */ - is_partial?: boolean; -} - export interface IEnhancedEsSearchRequest extends IEsSearchRequest { /** * Used to determine whether to use the _rollups_search or a regular search endpoint. diff --git a/x-pack/plugins/data_enhanced/public/search/search_interceptor.test.ts b/x-pack/plugins/data_enhanced/public/search/search_interceptor.test.ts index 639f56d0cafca7..d004511fa46749 100644 --- a/x-pack/plugins/data_enhanced/public/search/search_interceptor.test.ts +++ b/x-pack/plugins/data_enhanced/public/search/search_interceptor.test.ts @@ -72,8 +72,8 @@ describe('EnhancedSearchInterceptor', () => { { time: 10, value: { - is_partial: false, - is_running: false, + isPartial: false, + isRunning: false, id: 1, rawResponse: { took: 1, @@ -99,8 +99,8 @@ describe('EnhancedSearchInterceptor', () => { { time: 10, value: { - is_partial: false, - is_running: true, + isPartial: false, + isRunning: true, id: 1, rawResponse: { took: 1, @@ -110,8 +110,8 @@ describe('EnhancedSearchInterceptor', () => { { time: 20, value: { - is_partial: false, - is_running: false, + isPartial: false, + isRunning: false, id: 1, rawResponse: { took: 1, @@ -144,8 +144,8 @@ describe('EnhancedSearchInterceptor', () => { { time: 10, value: { - is_partial: true, - is_running: false, + isPartial: true, + isRunning: false, id: 1, }, }, @@ -168,8 +168,8 @@ describe('EnhancedSearchInterceptor', () => { { time: 500, value: { - is_partial: false, - is_running: false, + isPartial: false, + isRunning: false, id: 1, }, }, @@ -194,16 +194,16 @@ describe('EnhancedSearchInterceptor', () => { { time: 10, value: { - is_partial: false, - is_running: true, + isPartial: false, + isRunning: true, id: 1, }, }, { time: 300, value: { - is_partial: false, - is_running: false, + isPartial: false, + isRunning: false, id: 1, }, }, @@ -238,8 +238,8 @@ describe('EnhancedSearchInterceptor', () => { { time: 2000, value: { - is_partial: false, - is_running: false, + isPartial: false, + isRunning: false, id: 1, }, }, @@ -262,16 +262,16 @@ describe('EnhancedSearchInterceptor', () => { { time: 10, value: { - is_partial: false, - is_running: true, + isPartial: false, + isRunning: true, id: 1, }, }, { time: 2000, value: { - is_partial: false, - is_running: false, + isPartial: false, + isRunning: false, id: 1, }, }, @@ -302,8 +302,8 @@ describe('EnhancedSearchInterceptor', () => { { time: 10, value: { - is_partial: false, - is_running: true, + isPartial: false, + isRunning: true, id: 1, }, }, @@ -311,8 +311,8 @@ describe('EnhancedSearchInterceptor', () => { time: 10, value: { error: 'oh no', - is_partial: false, - is_running: false, + isPartial: false, + isRunning: false, id: 1, }, isError: true, @@ -346,16 +346,16 @@ describe('EnhancedSearchInterceptor', () => { { time: 10, value: { - is_partial: false, - is_running: false, + isPartial: false, + isRunning: false, id: 1, }, }, { time: 20, value: { - is_partial: false, - is_running: false, + isPartial: false, + isRunning: false, id: 1, }, }, @@ -380,8 +380,8 @@ describe('EnhancedSearchInterceptor', () => { { time: 250, value: { - is_partial: true, - is_running: true, + isPartial: true, + isRunning: true, id: 1, rawResponse: { took: 1, @@ -391,8 +391,8 @@ describe('EnhancedSearchInterceptor', () => { { time: 2000, value: { - is_partial: false, - is_running: false, + isPartial: false, + isRunning: false, id: 1, rawResponse: { took: 1, diff --git a/x-pack/plugins/data_enhanced/public/search/search_interceptor.ts b/x-pack/plugins/data_enhanced/public/search/search_interceptor.ts index 927dc91f365b72..bff9e2cb9048c8 100644 --- a/x-pack/plugins/data_enhanced/public/search/search_interceptor.ts +++ b/x-pack/plugins/data_enhanced/public/search/search_interceptor.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { Observable, throwError, EMPTY, timer, from } from 'rxjs'; +import { throwError, EMPTY, timer, from } from 'rxjs'; import { mergeMap, expand, takeUntil, finalize, tap } from 'rxjs/operators'; import { getLongQueryNotification } from './long_query_notification'; import { @@ -14,7 +14,7 @@ import { } from '../../../../../src/plugins/data/public'; import { AbortError, toPromise } from '../../../../../src/plugins/data/common'; import { IAsyncSearchOptions } from '.'; -import { IAsyncSearchRequest, IAsyncSearchResponse } from '../../common'; +import { IAsyncSearchRequest } from '../../common'; export class EnhancedSearchInterceptor extends SearchInterceptor { /** @@ -51,7 +51,7 @@ export class EnhancedSearchInterceptor extends SearchInterceptor { if (this.longRunningToast) return; this.longRunningToast = this.deps.toasts.addInfo( { - title: 'Your query is taking awhile', + title: 'Your query is taking a while', text: getLongQueryNotification({ cancel: this.cancelPending, runBeyondTimeout: this.runBeyondTimeout, @@ -67,7 +67,7 @@ export class EnhancedSearchInterceptor extends SearchInterceptor { public search( request: IAsyncSearchRequest, { pollInterval = 1000, ...options }: IAsyncSearchOptions = {} - ): Observable { + ) { let { id } = request; request.params = { @@ -80,15 +80,15 @@ export class EnhancedSearchInterceptor extends SearchInterceptor { this.pendingCount$.next(++this.pendingCount); - return (this.runSearch(request, combinedSignal) as Observable).pipe( - expand((response: IAsyncSearchResponse) => { + return this.runSearch(request, combinedSignal, options?.strategy).pipe( + expand((response) => { // If the response indicates of an error, stop polling and complete the observable - if (!response || (!response.is_running && response.is_partial)) { + if (!response || (!response.isRunning && response.isPartial)) { return throwError(new AbortError()); } // If the response indicates it is complete, stop polling and complete the observable - if (!response.is_running) { + if (!response.isRunning) { return EMPTY; } @@ -97,7 +97,7 @@ export class EnhancedSearchInterceptor extends SearchInterceptor { return timer(pollInterval).pipe( // Send future requests using just the ID from the response mergeMap(() => { - return this.runSearch({ id }, combinedSignal) as Observable; + return this.runSearch({ id }, combinedSignal, options?.strategy); }) ); }), diff --git a/x-pack/plugins/data_enhanced/server/search/es_search_strategy.ts b/x-pack/plugins/data_enhanced/server/search/es_search_strategy.ts index 0ed5485cfb6c9c..95f1285363f494 100644 --- a/x-pack/plugins/data_enhanced/server/search/es_search_strategy.ts +++ b/x-pack/plugins/data_enhanced/server/search/es_search_strategy.ts @@ -128,8 +128,8 @@ async function asyncSearch( return { id, - is_partial, - is_running, + isPartial: is_partial, + isRunning: is_running, rawResponse: shimHitsTotal(response), ...getTotalLoaded(response._shards), }; diff --git a/x-pack/plugins/event_log/server/event_log_client.test.ts b/x-pack/plugins/event_log/server/event_log_client.test.ts index 917d517a6e27d1..3273fe847080f8 100644 --- a/x-pack/plugins/event_log/server/event_log_client.test.ts +++ b/x-pack/plugins/event_log/server/event_log_client.test.ts @@ -7,7 +7,6 @@ import { KibanaRequest } from 'src/core/server'; import { EventLogClient } from './event_log_client'; import { contextMock } from './es/context.mock'; -import { savedObjectsClientMock } from 'src/core/server/mocks'; import { merge } from 'lodash'; import moment from 'moment'; @@ -15,14 +14,15 @@ describe('EventLogStart', () => { describe('findEventsBySavedObject', () => { test('verifies that the user can access the specified saved object', async () => { const esContext = contextMock.create(); - const savedObjectsClient = savedObjectsClientMock.create(); + const savedObjectGetter = jest.fn(); + const eventLogClient = new EventLogClient({ esContext, - savedObjectsClient, + savedObjectGetter, request: FakeRequest(), }); - savedObjectsClient.get.mockResolvedValueOnce({ + savedObjectGetter.mockResolvedValueOnce({ id: 'saved-object-id', type: 'saved-object-type', attributes: {}, @@ -31,19 +31,21 @@ describe('EventLogStart', () => { await eventLogClient.findEventsBySavedObject('saved-object-type', 'saved-object-id'); - expect(savedObjectsClient.get).toHaveBeenCalledWith('saved-object-type', 'saved-object-id'); + expect(savedObjectGetter).toHaveBeenCalledWith('saved-object-type', 'saved-object-id'); }); test('throws when the user doesnt have permission to access the specified saved object', async () => { const esContext = contextMock.create(); - const savedObjectsClient = savedObjectsClientMock.create(); + + const savedObjectGetter = jest.fn(); + const eventLogClient = new EventLogClient({ esContext, - savedObjectsClient, + savedObjectGetter, request: FakeRequest(), }); - savedObjectsClient.get.mockRejectedValue(new Error('Fail')); + savedObjectGetter.mockRejectedValue(new Error('Fail')); expect( eventLogClient.findEventsBySavedObject('saved-object-type', 'saved-object-id') @@ -52,14 +54,16 @@ describe('EventLogStart', () => { test('fetches all event that reference the saved object', async () => { const esContext = contextMock.create(); - const savedObjectsClient = savedObjectsClientMock.create(); + + const savedObjectGetter = jest.fn(); + const eventLogClient = new EventLogClient({ esContext, - savedObjectsClient, + savedObjectGetter, request: FakeRequest(), }); - savedObjectsClient.get.mockResolvedValueOnce({ + savedObjectGetter.mockResolvedValueOnce({ id: 'saved-object-id', type: 'saved-object-type', attributes: {}, @@ -125,14 +129,16 @@ describe('EventLogStart', () => { test('fetches all events in time frame that reference the saved object', async () => { const esContext = contextMock.create(); - const savedObjectsClient = savedObjectsClientMock.create(); + + const savedObjectGetter = jest.fn(); + const eventLogClient = new EventLogClient({ esContext, - savedObjectsClient, + savedObjectGetter, request: FakeRequest(), }); - savedObjectsClient.get.mockResolvedValueOnce({ + savedObjectGetter.mockResolvedValueOnce({ id: 'saved-object-id', type: 'saved-object-type', attributes: {}, @@ -206,14 +212,16 @@ describe('EventLogStart', () => { test('validates that the start date is valid', async () => { const esContext = contextMock.create(); - const savedObjectsClient = savedObjectsClientMock.create(); + + const savedObjectGetter = jest.fn(); + const eventLogClient = new EventLogClient({ esContext, - savedObjectsClient, + savedObjectGetter, request: FakeRequest(), }); - savedObjectsClient.get.mockResolvedValueOnce({ + savedObjectGetter.mockResolvedValueOnce({ id: 'saved-object-id', type: 'saved-object-type', attributes: {}, @@ -236,14 +244,16 @@ describe('EventLogStart', () => { test('validates that the end date is valid', async () => { const esContext = contextMock.create(); - const savedObjectsClient = savedObjectsClientMock.create(); + + const savedObjectGetter = jest.fn(); + const eventLogClient = new EventLogClient({ esContext, - savedObjectsClient, + savedObjectGetter, request: FakeRequest(), }); - savedObjectsClient.get.mockResolvedValueOnce({ + savedObjectGetter.mockResolvedValueOnce({ id: 'saved-object-id', type: 'saved-object-type', attributes: {}, @@ -297,7 +307,8 @@ function fakeEvent(overrides = {}) { } function FakeRequest(): KibanaRequest { - const savedObjectsClient = savedObjectsClientMock.create(); + const savedObjectGetter = jest.fn(); + return ({ headers: {}, getBasePath: () => '', @@ -311,6 +322,6 @@ function FakeRequest(): KibanaRequest { url: '/', }, }, - getSavedObjectsClient: () => savedObjectsClient, + getSavedObjectsClient: () => savedObjectGetter, } as unknown) as KibanaRequest; } diff --git a/x-pack/plugins/event_log/server/event_log_client.ts b/x-pack/plugins/event_log/server/event_log_client.ts index f4115e06160d75..32fd99d1700267 100644 --- a/x-pack/plugins/event_log/server/event_log_client.ts +++ b/x-pack/plugins/event_log/server/event_log_client.ts @@ -6,12 +6,13 @@ import { Observable } from 'rxjs'; import { schema, TypeOf } from '@kbn/config-schema'; -import { LegacyClusterClient, SavedObjectsClientContract, KibanaRequest } from 'src/core/server'; +import { LegacyClusterClient, KibanaRequest } from 'src/core/server'; import { SpacesServiceSetup } from '../../spaces/server'; import { EsContext } from './es'; import { IEventLogClient } from './types'; import { QueryEventsBySavedObjectResult } from './es/cluster_client_adapter'; +import { SavedObjectGetter } from './saved_object_provider_registry'; export type PluginClusterClient = Pick; export type AdminClusterClient$ = Observable; @@ -58,7 +59,7 @@ export type FindOptionsType = Pick< interface EventLogServiceCtorParams { esContext: EsContext; - savedObjectsClient: SavedObjectsClientContract; + savedObjectGetter: SavedObjectGetter; spacesService?: SpacesServiceSetup; request: KibanaRequest; } @@ -66,18 +67,13 @@ interface EventLogServiceCtorParams { // note that clusterClient may be null, indicating we can't write to ES export class EventLogClient implements IEventLogClient { private esContext: EsContext; - private savedObjectsClient: SavedObjectsClientContract; + private savedObjectGetter: SavedObjectGetter; private spacesService?: SpacesServiceSetup; private request: KibanaRequest; - constructor({ - esContext, - savedObjectsClient, - spacesService, - request, - }: EventLogServiceCtorParams) { + constructor({ esContext, savedObjectGetter, spacesService, request }: EventLogServiceCtorParams) { this.esContext = esContext; - this.savedObjectsClient = savedObjectsClient; + this.savedObjectGetter = savedObjectGetter; this.spacesService = spacesService; this.request = request; } @@ -93,7 +89,7 @@ export class EventLogClient implements IEventLogClient { const namespace = space && this.spacesService?.spaceIdToNamespace(space.id); // verify the user has the required permissions to view this saved object - await this.savedObjectsClient.get(type, id); + await this.savedObjectGetter(type, id); return await this.esContext.esAdapter.queryEventsBySavedObject( this.esContext.esNames.alias, diff --git a/x-pack/plugins/event_log/server/event_log_service.mock.ts b/x-pack/plugins/event_log/server/event_log_service.mock.ts index 805c241414a2e2..877e5d59a1831f 100644 --- a/x-pack/plugins/event_log/server/event_log_service.mock.ts +++ b/x-pack/plugins/event_log/server/event_log_service.mock.ts @@ -15,6 +15,7 @@ const createEventLogServiceMock = () => { registerProviderActions: jest.fn(), isProviderActionRegistered: jest.fn(), getProviderActions: jest.fn(), + registerSavedObjectProvider: jest.fn(), getLogger: jest.fn().mockReturnValue(eventLoggerMock.create()), }; return mock; diff --git a/x-pack/plugins/event_log/server/event_log_service.test.ts b/x-pack/plugins/event_log/server/event_log_service.test.ts index 2cf68592f2fa17..2b92443569f4fb 100644 --- a/x-pack/plugins/event_log/server/event_log_service.test.ts +++ b/x-pack/plugins/event_log/server/event_log_service.test.ts @@ -8,9 +8,11 @@ import { IEventLogConfig } from './types'; import { EventLogService } from './event_log_service'; import { contextMock } from './es/context.mock'; import { loggingSystemMock } from 'src/core/server/mocks'; +import { savedObjectProviderRegistryMock } from './saved_object_provider_registry.mock'; const loggingService = loggingSystemMock.create(); const systemLogger = loggingService.get(); +const savedObjectProviderRegistry = savedObjectProviderRegistryMock.create(); describe('EventLogService', () => { const esContext = contextMock.create(); @@ -21,6 +23,7 @@ describe('EventLogService', () => { esContext, systemLogger, kibanaUUID: '42', + savedObjectProviderRegistry, config: { enabled, logEntries, @@ -65,6 +68,7 @@ describe('EventLogService', () => { esContext, systemLogger, kibanaUUID: '42', + savedObjectProviderRegistry, config: { enabled: true, logEntries: true, @@ -102,6 +106,7 @@ describe('EventLogService', () => { esContext, systemLogger, kibanaUUID: '42', + savedObjectProviderRegistry, config: { enabled: true, logEntries: true, @@ -112,4 +117,24 @@ describe('EventLogService', () => { const eventLogger = service.getLogger({}); expect(eventLogger).toBeTruthy(); }); + + describe('registerSavedObjectProvider', () => { + test('register SavedObject Providers in the registry', () => { + const params = { + esContext, + systemLogger, + kibanaUUID: '42', + savedObjectProviderRegistry, + config: { + enabled: true, + logEntries: true, + indexEntries: true, + }, + }; + const service = new EventLogService(params); + const provider = jest.fn(); + service.registerSavedObjectProvider('myType', provider); + expect(savedObjectProviderRegistry.registerProvider).toHaveBeenCalledWith('myType', provider); + }); + }); }); diff --git a/x-pack/plugins/event_log/server/event_log_service.ts b/x-pack/plugins/event_log/server/event_log_service.ts index f7f915f1cf0efc..9249288d339393 100644 --- a/x-pack/plugins/event_log/server/event_log_service.ts +++ b/x-pack/plugins/event_log/server/event_log_service.ts @@ -11,6 +11,7 @@ import { Plugin } from './plugin'; import { EsContext } from './es'; import { IEvent, IEventLogger, IEventLogService, IEventLogConfig } from './types'; import { EventLogger } from './event_logger'; +import { SavedObjectProvider, SavedObjectProviderRegistry } from './saved_object_provider_registry'; export type PluginClusterClient = Pick; export type AdminClusterClient$ = Observable; @@ -21,6 +22,7 @@ interface EventLogServiceCtorParams { esContext: EsContext; kibanaUUID: string; systemLogger: SystemLogger; + savedObjectProviderRegistry: SavedObjectProviderRegistry; } // note that clusterClient may be null, indicating we can't write to ES @@ -29,15 +31,23 @@ export class EventLogService implements IEventLogService { private esContext: EsContext; private systemLogger: SystemLogger; private registeredProviderActions: Map>; + private savedObjectProviderRegistry: SavedObjectProviderRegistry; public readonly kibanaUUID: string; - constructor({ config, esContext, kibanaUUID, systemLogger }: EventLogServiceCtorParams) { + constructor({ + config, + esContext, + kibanaUUID, + systemLogger, + savedObjectProviderRegistry, + }: EventLogServiceCtorParams) { this.config = config; this.esContext = esContext; this.kibanaUUID = kibanaUUID; this.systemLogger = systemLogger; this.registeredProviderActions = new Map>(); + this.savedObjectProviderRegistry = savedObjectProviderRegistry; } public isEnabled(): boolean { @@ -77,6 +87,10 @@ export class EventLogService implements IEventLogService { return new Map(this.registeredProviderActions.entries()); } + registerSavedObjectProvider(type: string, provider: SavedObjectProvider) { + return this.savedObjectProviderRegistry.registerProvider(type, provider); + } + getLogger(initialProperties: IEvent): IEventLogger { return new EventLogger({ esContext: this.esContext, diff --git a/x-pack/plugins/event_log/server/event_log_start_service.test.ts b/x-pack/plugins/event_log/server/event_log_start_service.test.ts index 3bd5ef7c0b3bae..cbdc168a8ffdeb 100644 --- a/x-pack/plugins/event_log/server/event_log_start_service.test.ts +++ b/x-pack/plugins/event_log/server/event_log_start_service.test.ts @@ -5,10 +5,11 @@ */ import { KibanaRequest } from 'src/core/server'; -import { savedObjectsClientMock, savedObjectsServiceMock } from 'src/core/server/mocks'; +import { savedObjectsClientMock } from 'src/core/server/mocks'; import { EventLogClientService } from './event_log_start_service'; import { contextMock } from './es/context.mock'; +import { savedObjectProviderRegistryMock } from './saved_object_provider_registry.mock'; jest.mock('./event_log_client'); @@ -17,19 +18,17 @@ describe('EventLogClientService', () => { describe('getClient', () => { test('creates a client with a scoped SavedObjects client', () => { - const savedObjectsService = savedObjectsServiceMock.createStartContract(); + const savedObjectProviderRegistry = savedObjectProviderRegistryMock.create(); const request = fakeRequest(); const eventLogStartService = new EventLogClientService({ esContext, - savedObjectsService, + savedObjectProviderRegistry, }); eventLogStartService.getClient(request); - expect(savedObjectsService.getScopedClient).toHaveBeenCalledWith(request, { - includedHiddenTypes: ['action', 'alert'], - }); + expect(savedObjectProviderRegistry.getProvidersClient).toHaveBeenCalledWith(request); }); }); }); diff --git a/x-pack/plugins/event_log/server/event_log_start_service.ts b/x-pack/plugins/event_log/server/event_log_start_service.ts index 8b752684c1cc3c..5cadab4df3ed71 100644 --- a/x-pack/plugins/event_log/server/event_log_start_service.ts +++ b/x-pack/plugins/event_log/server/event_log_start_service.ts @@ -5,49 +5,42 @@ */ import { Observable } from 'rxjs'; -import { - LegacyClusterClient, - KibanaRequest, - SavedObjectsServiceStart, - SavedObjectsClientContract, -} from 'src/core/server'; +import { LegacyClusterClient, KibanaRequest } from 'src/core/server'; import { SpacesServiceSetup } from '../../spaces/server'; import { EsContext } from './es'; import { IEventLogClientService } from './types'; import { EventLogClient } from './event_log_client'; +import { SavedObjectProviderRegistry } from './saved_object_provider_registry'; export type PluginClusterClient = Pick; export type AdminClusterClient$ = Observable; -const includedHiddenTypes = ['action', 'alert']; - interface EventLogServiceCtorParams { esContext: EsContext; - savedObjectsService: SavedObjectsServiceStart; + savedObjectProviderRegistry: SavedObjectProviderRegistry; spacesService?: SpacesServiceSetup; } // note that clusterClient may be null, indicating we can't write to ES export class EventLogClientService implements IEventLogClientService { private esContext: EsContext; - private savedObjectsService: SavedObjectsServiceStart; + private savedObjectProviderRegistry: SavedObjectProviderRegistry; private spacesService?: SpacesServiceSetup; - constructor({ esContext, savedObjectsService, spacesService }: EventLogServiceCtorParams) { + constructor({ + esContext, + savedObjectProviderRegistry, + spacesService, + }: EventLogServiceCtorParams) { this.esContext = esContext; - this.savedObjectsService = savedObjectsService; + this.savedObjectProviderRegistry = savedObjectProviderRegistry; this.spacesService = spacesService; } getClient(request: KibanaRequest) { - const savedObjectsClient: SavedObjectsClientContract = this.savedObjectsService.getScopedClient( - request, - { includedHiddenTypes } - ); - return new EventLogClient({ esContext: this.esContext, - savedObjectsClient, + savedObjectGetter: this.savedObjectProviderRegistry.getProvidersClient(request), spacesService: this.spacesService, request, }); diff --git a/x-pack/plugins/event_log/server/event_logger.test.ts b/x-pack/plugins/event_log/server/event_logger.test.ts index fde3b2de8dd36e..0ab3071f70efaa 100644 --- a/x-pack/plugins/event_log/server/event_logger.test.ts +++ b/x-pack/plugins/event_log/server/event_logger.test.ts @@ -12,6 +12,7 @@ import { contextMock } from './es/context.mock'; import { loggingSystemMock } from 'src/core/server/mocks'; import { delay } from './lib/delay'; import { EVENT_LOGGED_PREFIX } from './event_logger'; +import { savedObjectProviderRegistryMock } from './saved_object_provider_registry.mock'; const KIBANA_SERVER_UUID = '424-24-2424'; const WRITE_LOG_WAIT_MILLIS = 3000; @@ -31,6 +32,7 @@ describe('EventLogger', () => { systemLogger, config: { enabled: true, logEntries: true, indexEntries: true }, kibanaUUID: KIBANA_SERVER_UUID, + savedObjectProviderRegistry: savedObjectProviderRegistryMock.create(), }); eventLogger = service.getLogger({}); }); diff --git a/x-pack/plugins/event_log/server/plugin.ts b/x-pack/plugins/event_log/server/plugin.ts index 9e36ca10b71f21..1353877fa4629a 100644 --- a/x-pack/plugins/event_log/server/plugin.ts +++ b/x-pack/plugins/event_log/server/plugin.ts @@ -30,6 +30,7 @@ import { findRoute } from './routes'; import { EventLogService } from './event_log_service'; import { createEsContext, EsContext } from './es'; import { EventLogClientService } from './event_log_start_service'; +import { SavedObjectProviderRegistry } from './saved_object_provider_registry'; export type PluginClusterClient = Pick; @@ -53,11 +54,13 @@ export class Plugin implements CorePlugin; private eventLogClientService?: EventLogClientService; private spacesService?: SpacesServiceSetup; + private savedObjectProviderRegistry: SavedObjectProviderRegistry; constructor(private readonly context: PluginInitializerContext) { this.systemLogger = this.context.logger.get(); this.config$ = this.context.config.create(); this.globalConfig$ = this.context.config.legacy.globalConfig$; + this.savedObjectProviderRegistry = new SavedObjectProviderRegistry(); } async setup(core: CoreSetup, { spaces }: PluginSetupDeps): Promise { @@ -83,6 +86,7 @@ export class Plugin implements CorePlugin { + const client = core.savedObjects.getScopedClient(request); + return client.get.bind(client); + }); + this.eventLogClientService = new EventLogClientService({ esContext: this.esContext, - savedObjectsService: core.savedObjects, + savedObjectProviderRegistry: this.savedObjectProviderRegistry, spacesService: this.spacesService, }); return this.eventLogClientService; diff --git a/x-pack/plugins/event_log/server/saved_object_provider_registry.mock.ts b/x-pack/plugins/event_log/server/saved_object_provider_registry.mock.ts new file mode 100644 index 00000000000000..433deaf7bff728 --- /dev/null +++ b/x-pack/plugins/event_log/server/saved_object_provider_registry.mock.ts @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { SavedObjectProviderRegistry } from './saved_object_provider_registry'; + +const createSavedObjectProviderRegistryMock = () => { + return ({ + registerProvider: jest.fn(), + registerDefaultProvider: jest.fn(), + getProvidersClient: jest.fn(), + } as unknown) as jest.Mocked; +}; + +export const savedObjectProviderRegistryMock = { + create: createSavedObjectProviderRegistryMock, +}; diff --git a/x-pack/plugins/event_log/server/saved_object_provider_registry.test.ts b/x-pack/plugins/event_log/server/saved_object_provider_registry.test.ts new file mode 100644 index 00000000000000..6a02d54c875145 --- /dev/null +++ b/x-pack/plugins/event_log/server/saved_object_provider_registry.test.ts @@ -0,0 +1,98 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { SavedObjectProviderRegistry } from './saved_object_provider_registry'; +import uuid from 'uuid'; +import { KibanaRequest } from 'src/core/server'; +import { savedObjectsClientMock } from 'src/core/server/mocks'; + +describe('SavedObjectProviderRegistry', () => { + beforeEach(() => jest.resetAllMocks()); + + describe('registerProvider()', () => { + test('should register providers', () => { + const registry = new SavedObjectProviderRegistry(); + registry.registerProvider('alert', jest.fn()); + }); + + test('should throw an error if type is already registered', () => { + const registry = new SavedObjectProviderRegistry(); + registry.registerProvider('alert', jest.fn()); + expect(() => + registry.registerProvider('alert', jest.fn()) + ).toThrowErrorMatchingInlineSnapshot( + `"The Event Log has already registered a Provider for the Save Object type \\"alert\\"."` + ); + }); + }); + + describe('getProvidersClient()', () => { + test('should get SavedObject using the registered provider by type', async () => { + const registry = new SavedObjectProviderRegistry(); + registry.registerDefaultProvider(jest.fn()); + + const getter = jest.fn(); + const provider = jest.fn().mockReturnValue(getter); + registry.registerProvider('alert', provider); + + const request = fakeRequest(); + const alert = { + id: uuid.v4(), + }; + + getter.mockResolvedValue(alert); + + expect(await registry.getProvidersClient(request)('alert', alert.id)).toMatchObject(alert); + + expect(provider).toHaveBeenCalledWith(request); + expect(getter).toHaveBeenCalledWith('alert', alert.id); + }); + + test('should get SavedObject using the default provider for unregistered types', async () => { + const registry = new SavedObjectProviderRegistry(); + const defaultProvider = jest.fn(); + registry.registerDefaultProvider(defaultProvider); + + registry.registerProvider('alert', jest.fn().mockReturnValue(jest.fn())); + + const request = fakeRequest(); + const action = { + id: uuid.v4(), + type: 'action', + attributes: {}, + references: [], + }; + + const getter = jest.fn(); + defaultProvider.mockReturnValue(getter); + getter.mockResolvedValue(action); + + expect(await registry.getProvidersClient(request)('action', action.id)).toMatchObject(action); + + expect(getter).toHaveBeenCalledWith('action', action.id); + expect(defaultProvider).toHaveBeenCalledWith(request); + }); + }); +}); + +function fakeRequest(): KibanaRequest { + const savedObjectsClient = savedObjectsClientMock.create(); + return ({ + headers: {}, + getBasePath: () => '', + path: '/', + route: { settings: {} }, + url: { + href: '/', + }, + raw: { + req: { + url: '/', + }, + }, + getSavedObjectsClient: () => savedObjectsClient, + } as unknown) as KibanaRequest; +} diff --git a/x-pack/plugins/event_log/server/saved_object_provider_registry.ts b/x-pack/plugins/event_log/server/saved_object_provider_registry.ts new file mode 100644 index 00000000000000..87a1da5dd6f4aa --- /dev/null +++ b/x-pack/plugins/event_log/server/saved_object_provider_registry.ts @@ -0,0 +1,68 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; +import { KibanaRequest, SavedObjectsClientContract } from 'src/core/server'; + +import { fromNullable, getOrElse } from 'fp-ts/lib/Option'; +import { pipe } from 'fp-ts/lib/pipeable'; + +export type SavedObjectGetter = ( + ...params: Parameters +) => Promise; +export type SavedObjectProvider = (request: KibanaRequest) => SavedObjectGetter; + +export class SavedObjectProviderRegistry { + private providers = new Map(); + private defaultProvider?: SavedObjectProvider; + + constructor() {} + + public registerDefaultProvider(provider: SavedObjectProvider) { + this.defaultProvider = provider; + } + + public registerProvider(type: string, provider: SavedObjectProvider) { + if (this.providers.has(type)) { + throw new Error( + `The Event Log has already registered a Provider for the Save Object type "${type}".` + ); + } + this.providers.set(type, provider); + } + + public getProvidersClient(request: KibanaRequest): SavedObjectGetter { + if (!this.defaultProvider) { + throw new Error( + i18n.translate( + 'xpack.eventLog.savedObjectProviderRegistry.getProvidersClient.noDefaultProvider', + { + defaultMessage: 'The Event Log requires a default Provider.', + } + ) + ); + } + + // `scopedProviders` is a cache of providers which are scoped t othe current request. + // The client will only instantiate a provider on-demand and it will cache each + // one to enable the request to reuse each provider. + const scopedProviders = new Map(); + const defaultGetter = this.defaultProvider(request); + return (type: string, id: string) => { + const getter = pipe( + fromNullable(scopedProviders.get(type)), + getOrElse(() => { + const client = this.providers.has(type) + ? this.providers.get(type)!(request) + : defaultGetter; + scopedProviders.set(type, client); + return client; + }) + ); + return getter(type, id); + }; + } +} diff --git a/x-pack/plugins/event_log/server/types.ts b/x-pack/plugins/event_log/server/types.ts index 1a37c4e58d0799..cda95792206234 100644 --- a/x-pack/plugins/event_log/server/types.ts +++ b/x-pack/plugins/event_log/server/types.ts @@ -12,6 +12,7 @@ export { IEvent, IValidatedEvent, EventSchema, ECS_VERSION } from '../generated/ import { IEvent } from '../generated/schemas'; import { FindOptionsType } from './event_log_client'; import { QueryEventsBySavedObjectResult } from './es/cluster_client_adapter'; +import { SavedObjectProvider } from './saved_object_provider_registry'; export const SAVED_OBJECT_REL_PRIMARY = 'primary'; @@ -40,7 +41,7 @@ export interface IEventLogService { registerProviderActions(provider: string, actions: string[]): void; isProviderActionRegistered(provider: string, action: string): boolean; getProviderActions(): Map>; - + registerSavedObjectProvider(type: string, provider: SavedObjectProvider): void; getLogger(properties: IEvent): IEventLogger; } diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/__jest__/pipeline_processors_editor.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/__jest__/pipeline_processors_editor.test.tsx index a45a677846b2ec..d3c5df02c837ee 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/__jest__/pipeline_processors_editor.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/__jest__/pipeline_processors_editor.test.tsx @@ -186,7 +186,7 @@ describe('Pipeline Editor', () => { it('prevents moving a processor while in edit mode', () => { const { find, exists } = testBed; - find('processors>0.editItemButton').simulate('click'); + find('processors>0.manageItemButton').simulate('click'); expect(exists('processorSettingsForm')).toBe(true); expect(find('processors>0.moveItemButton').props().disabled).toBe(true); expect(find('processors>1.moveItemButton').props().disabled).toBe(true); diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/index.ts index bf724be950fdf1..3b0ae477c871f9 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/index.ts @@ -5,10 +5,10 @@ */ export { - ProcessorSettingsForm, - ProcessorSettingsFromOnSubmitArg, + ManageProcessorForm, + ManageProcessorFormOnSubmitArg, OnSubmitHandler, -} from './processor_settings_form'; +} from './manage_processor_form'; export { ProcessorsTree, ProcessorInfo, OnActionHandler } from './processors_tree'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/documentation_button.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/documentation_button.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/documentation_button.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/documentation_button.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/field_components/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/field_components/index.ts similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/field_components/index.ts rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/field_components/index.ts diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/field_components/text_editor.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/field_components/text_editor.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/field_components/text_editor.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/field_components/text_editor.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/field_components/xjson_editor.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/field_components/xjson_editor.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/field_components/xjson_editor.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/field_components/xjson_editor.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/index.ts similarity index 71% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/index.ts rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/index.ts index 1a7da4891967a2..986bd52e911bf2 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/index.ts @@ -5,7 +5,7 @@ */ export { - ProcessorSettingsForm, - ProcessorSettingsFromOnSubmitArg, + ManageProcessorForm, + ManageProcessorFormOnSubmitArg, OnSubmitHandler, -} from './processor_settings_form.container'; +} from './manage_processor_form.container'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processor_settings_form.container.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/manage_processor_form.container.tsx similarity index 85% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processor_settings_form.container.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/manage_processor_form.container.tsx index 9480c64faa261e..84551ce152099a 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processor_settings_form.container.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/manage_processor_form.container.tsx @@ -9,12 +9,12 @@ import React, { FunctionComponent, useCallback, useEffect } from 'react'; import { useForm, OnFormUpdateArg, FormData } from '../../../../../shared_imports'; import { ProcessorInternal } from '../../types'; -import { ProcessorSettingsForm as ViewComponent } from './processor_settings_form'; +import { ManageProcessorForm as ViewComponent } from './manage_processor_form'; import { usePipelineProcessorsContext } from '../../context'; -export type ProcessorSettingsFromOnSubmitArg = Omit; +export type ManageProcessorFormOnSubmitArg = Omit; -export type OnSubmitHandler = (processor: ProcessorSettingsFromOnSubmitArg) => void; +export type OnSubmitHandler = (processor: ManageProcessorFormOnSubmitArg) => void; export type OnFormUpdateHandler = (form: OnFormUpdateArg) => void; @@ -27,7 +27,7 @@ interface Props { processor?: ProcessorInternal; } -export const ProcessorSettingsForm: FunctionComponent = ({ +export const ManageProcessorForm: FunctionComponent = ({ processor, onFormUpdate, onSubmit, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processor_settings_form.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/manage_processor_form.tsx similarity index 60% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processor_settings_form.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/manage_processor_form.tsx index e44d5afd56296e..ad6d191be802df 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processor_settings_form.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/manage_processor_form.tsx @@ -6,15 +6,16 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import React, { FunctionComponent, memo, useEffect } from 'react'; +import React, { FunctionComponent, memo, useEffect, useState } from 'react'; import { EuiButton, EuiButtonEmpty, - EuiHorizontalRule, EuiFlyout, EuiFlyoutHeader, EuiFlyoutBody, EuiFlyoutFooter, + EuiTabs, + EuiTab, EuiTitle, EuiFlexGroup, EuiFlexItem, @@ -23,12 +24,10 @@ import { import { Form, FormDataProvider, FormHook } from '../../../../../shared_imports'; import { ProcessorInternal } from '../../types'; - import { getProcessorDescriptor } from '../shared'; +import { ProcessorSettingsFields } from './processor_settings_fields'; import { DocumentationButton } from './documentation_button'; -import { CommonProcessorFields, ProcessorTypeField } from './processors/common_fields'; -import { Custom } from './processors/custom'; export interface Props { isOnFailure: boolean; @@ -43,6 +42,7 @@ const updateButtonLabel = i18n.translate( 'xpack.ingestPipelines.settingsFormOnFailureFlyout.updateButtonLabel', { defaultMessage: 'Update' } ); + const addButtonLabel = i18n.translate( 'xpack.ingestPipelines.settingsFormOnFailureFlyout.addButtonLabel', { defaultMessage: 'Add' } @@ -53,20 +53,55 @@ const cancelButtonLabel = i18n.translate( { defaultMessage: 'Cancel' } ); -export const ProcessorSettingsForm: FunctionComponent = memo( - ({ processor, form, isOnFailure, onClose, onOpen, esDocsBasePath }) => { - const flyoutTitleContent = isOnFailure ? ( +export type TabType = 'configuration'; + +interface Tab { + id: TabType; + name: string; +} + +const tabs: Tab[] = [ + { + id: 'configuration', + name: i18n.translate( + 'xpack.ingestPipelines.settingsFormOnFailureFlyout.configurationTabTitle', + { + defaultMessage: 'Configuration', + } + ), + }, +]; + +const getFlyoutTitle = (isOnFailure: boolean, isExistingProcessor: boolean) => { + if (isExistingProcessor) { + return isOnFailure ? ( ) : ( ); + } + return isOnFailure ? ( + + ) : ( + + ); +}; + +export const ManageProcessorForm: FunctionComponent = memo( + ({ processor, form, isOnFailure, onClose, onOpen, esDocsBasePath }) => { useEffect( () => { onOpen(); @@ -74,6 +109,10 @@ export const ProcessorSettingsForm: FunctionComponent = memo( [] /* eslint-disable-line react-hooks/exhaustive-deps */ ); + const [activeTab, setActiveTab] = useState('configuration'); + + const flyoutContent = ; + return (
@@ -82,11 +121,10 @@ export const ProcessorSettingsForm: FunctionComponent = memo(
-

{flyoutTitleContent}

+

{getFlyoutTitle(isOnFailure, Boolean(processor))}

- {({ type }) => { @@ -107,33 +145,27 @@ export const ProcessorSettingsForm: FunctionComponent = memo( - - - - - - {(arg: any) => { - const { type } = arg; - - if (type?.length) { - const formDescriptor = getProcessorDescriptor(type as any); - - if (formDescriptor?.FieldsComponent) { - return ( - <> - - - - - ); - } - return ; - } - - // If the user has not yet defined a type, we do not show any settings fields - return null; - }} - + {processor ? ( + <> + + {tabs.map((tab) => ( + { + setActiveTab(tab.id); + }} + isSelected={tab.id === activeTab} + key={tab.id} + data-test-subj={`${tab.id}Tab`} + > + {tab.name} + + ))} + + + + ) : undefined} + + {flyoutContent} @@ -141,13 +173,7 @@ export const ProcessorSettingsForm: FunctionComponent = memo( {cancelButtonLabel} - { - form.submit(); - }} - > + {processor ? updateButtonLabel : addButtonLabel} diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processor_settings_fields.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processor_settings_fields.tsx new file mode 100644 index 00000000000000..a6447bc30ac00f --- /dev/null +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processor_settings_fields.tsx @@ -0,0 +1,53 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { FunctionComponent } from 'react'; +import { EuiHorizontalRule, EuiSpacer } from '@elastic/eui'; + +import { FormDataProvider } from '../../../../../shared_imports'; +import { ProcessorInternal } from '../../types'; + +import { getProcessorDescriptor } from '../shared'; +import { CommonProcessorFields, ProcessorTypeField } from './processors/common_fields'; +import { Custom } from './processors/custom'; + +export interface Props { + processor?: ProcessorInternal; +} + +export const ProcessorSettingsFields: FunctionComponent = ({ processor }) => { + return ( + <> + + + + + + {(arg: any) => { + const { type } = arg; + + if (type?.length) { + const formDescriptor = getProcessorDescriptor(type as any); + + if (formDescriptor?.FieldsComponent) { + return ( + <> + + + + + ); + } + return ; + } + + // If the user has not yet defined a type, we do not show any settings fields + return null; + }} + + + ); +}; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/append.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/append.tsx similarity index 96% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/append.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/append.tsx index f0b1d68462dc37..3f527301e3e326 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/append.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/append.tsx @@ -5,7 +5,6 @@ */ import React, { FunctionComponent } from 'react'; -import { EuiHorizontalRule } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FIELD_TYPES, fieldValidators, UseField, Field } from '../../../../../../shared_imports'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/bytes.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/bytes.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/bytes.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/bytes.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/circle.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/circle.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/circle.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/circle.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/common_fields/common_processor_fields.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/common_processor_fields.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/common_fields/common_processor_fields.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/common_processor_fields.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/common_fields/field_name_field.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/field_name_field.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/common_fields/field_name_field.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/field_name_field.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/common_fields/ignore_missing_field.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/ignore_missing_field.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/common_fields/ignore_missing_field.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/ignore_missing_field.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/common_fields/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/index.ts similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/common_fields/index.ts rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/index.ts diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/common_fields/processor_type_field.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/processor_type_field.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/common_fields/processor_type_field.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/processor_type_field.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/convert.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/convert.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/convert.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/convert.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/csv.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/csv.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/csv.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/csv.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/custom.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/custom.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/custom.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/custom.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/date.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/date.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/date.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/date.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/date_index_name.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/date_index_name.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/date_index_name.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/date_index_name.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/dissect.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/dissect.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/dissect.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/dissect.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/dot_expander.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/dot_expander.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/dot_expander.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/dot_expander.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/drop.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/drop.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/drop.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/drop.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/gsub.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/gsub.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/index.ts rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/set.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/set.tsx similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/set.tsx rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/set.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/shared.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts similarity index 100% rename from x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/processor_settings_form/processors/shared.ts rename to x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/pipeline_processors_editor_item/pipeline_processors_editor_item.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/pipeline_processors_editor_item/pipeline_processors_editor_item.tsx index edabbe277e5d94..a13321c38c1939 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/pipeline_processors_editor_item/pipeline_processors_editor_item.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/pipeline_processors_editor_item/pipeline_processors_editor_item.tsx @@ -7,10 +7,10 @@ import classNames from 'classnames'; import React, { FunctionComponent, memo } from 'react'; import { - EuiButtonIcon, EuiButtonToggle, EuiFlexGroup, EuiFlexItem, + EuiLink, EuiPanel, EuiText, EuiToolTip, @@ -57,9 +57,9 @@ export const PipelineProcessorsEditorItem: FunctionComponent = memo( const isInMoveMode = Boolean(movingProcessor); const isMovingThisProcessor = processor.id === movingProcessor?.id; const isEditingThisProcessor = - editor.mode.id === 'editingProcessor' && processor.id === editor.mode.arg.processor.id; + editor.mode.id === 'managingProcessor' && processor.id === editor.mode.arg.processor.id; const isEditingOtherProcessor = - editor.mode.id === 'editingProcessor' && !isEditingThisProcessor; + editor.mode.id === 'managingProcessor' && !isEditingThisProcessor; const isMovingOtherProcessor = editor.mode.id === 'movingProcessor' && !isMovingThisProcessor; const isDimmed = isEditingOtherProcessor || isMovingOtherProcessor; @@ -70,11 +70,6 @@ export const PipelineProcessorsEditorItem: FunctionComponent = memo( 'pipelineProcessorsEditor__item--dimmed': isDimmed, }); - const actionElementClasses = classNames({ - // eslint-disable-next-line @typescript-eslint/naming-convention - 'pipelineProcessorsEditor__item--displayNone': isInMoveMode, - }); - const inlineTextInputContainerClasses = classNames({ // eslint-disable-next-line @typescript-eslint/naming-convention 'pipelineProcessorsEditor__item--displayNone': isInMoveMode && !processor.options.description, @@ -141,7 +136,18 @@ export const PipelineProcessorsEditorItem: FunctionComponent = memo( className="pipelineProcessorsEditor__item__processorTypeLabel" color={isDimmed ? 'subdued' : undefined} > - {getProcessorDescriptor(processor.type)?.label ?? processor.type} + { + editor.setMode({ + id: 'managingProcessor', + arg: { processor, selector }, + }); + }} + data-test-subj="manageItemButton" + > + {getProcessorDescriptor(processor.type)?.label ?? processor.type} + @@ -174,25 +180,6 @@ export const PipelineProcessorsEditorItem: FunctionComponent = memo( placeholder={i18nTexts.descriptionPlaceholder} /> - - {!isInMoveMode && ( - - { - editor.setMode({ - id: 'editingProcessor', - arg: { processor, selector }, - }); - }} - /> - - )} - diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/context/processors_context.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/context/processors_context.tsx index db4629823ef52e..7124efc4905a76 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/context/processors_context.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/context/processors_context.tsx @@ -42,7 +42,7 @@ import { OnActionHandler } from '../components/processors_tree'; import { ProcessorRemoveModal, PipelineProcessorsItemTooltip, - ProcessorSettingsForm, + ManageProcessorForm, OnSubmitHandler, } from '../components'; @@ -148,7 +148,7 @@ export const PipelineProcessorsContextProvider: FunctionComponent = ({ }, }); break; - case 'editingProcessor': + case 'managingProcessor': processorsDispatch({ type: 'updateProcessor', payload: { @@ -229,10 +229,10 @@ export const PipelineProcessorsContextProvider: FunctionComponent = ({ /> )} - {mode.id === 'editingProcessor' || mode.id === 'creatingProcessor' ? ( - void; export type EditorMode = | { id: 'creatingProcessor'; arg: { selector: ProcessorSelector } } | { id: 'movingProcessor'; arg: ProcessorInfo } - | { id: 'editingProcessor'; arg: { processor: ProcessorInternal; selector: ProcessorSelector } } + | { id: 'managingProcessor'; arg: { processor: ProcessorInternal; selector: ProcessorSelector } } | { id: 'removingProcessor'; arg: { selector: ProcessorSelector } } | { id: 'idle' }; diff --git a/x-pack/plugins/lens/public/xy_visualization/__snapshots__/to_expression.test.ts.snap b/x-pack/plugins/lens/public/xy_visualization/__snapshots__/to_expression.test.ts.snap index b5783803b803c2..19ea75239ddb2a 100644 --- a/x-pack/plugins/lens/public/xy_visualization/__snapshots__/to_expression.test.ts.snap +++ b/x-pack/plugins/lens/public/xy_visualization/__snapshots__/to_expression.test.ts.snap @@ -8,6 +8,25 @@ Object { "fittingFunction": Array [ "Carry", ], + "gridlinesVisibilitySettings": Array [ + Object { + "chain": Array [ + Object { + "arguments": Object { + "x": Array [ + false, + ], + "y": Array [ + true, + ], + }, + "function": "lens_xy_gridlinesConfig", + "type": "function", + }, + ], + "type": "expression", + }, + ], "layers": Array [ Object { "chain": Array [ @@ -73,11 +92,36 @@ Object { "type": "expression", }, ], + "showXAxisTitle": Array [ + true, + ], + "showYAxisTitle": Array [ + true, + ], + "tickLabelsVisibilitySettings": Array [ + Object { + "chain": Array [ + Object { + "arguments": Object { + "x": Array [ + false, + ], + "y": Array [ + true, + ], + }, + "function": "lens_xy_tickLabelsConfig", + "type": "function", + }, + ], + "type": "expression", + }, + ], "xTitle": Array [ - "col_a", + "", ], "yTitle": Array [ - "col_b", + "", ], }, "function": "lens_xy_chart", diff --git a/x-pack/plugins/lens/public/xy_visualization/__snapshots__/xy_expression.test.tsx.snap b/x-pack/plugins/lens/public/xy_visualization/__snapshots__/xy_expression.test.tsx.snap index c7c173f87ad7cb..f0c233b44a2851 100644 --- a/x-pack/plugins/lens/public/xy_visualization/__snapshots__/xy_expression.test.tsx.snap +++ b/x-pack/plugins/lens/public/xy_visualization/__snapshots__/xy_expression.test.tsx.snap @@ -20,9 +20,14 @@ exports[`xy_expression XYChart component it renders area 1`] = ` } /> @@ -146,9 +151,14 @@ exports[`xy_expression XYChart component it renders bar 1`] = ` } /> @@ -262,9 +272,14 @@ exports[`xy_expression XYChart component it renders horizontal bar 1`] = ` } /> @@ -378,9 +393,14 @@ exports[`xy_expression XYChart component it renders line 1`] = ` } /> @@ -504,9 +524,14 @@ exports[`xy_expression XYChart component it renders stacked area 1`] = ` } /> @@ -628,9 +653,14 @@ exports[`xy_expression XYChart component it renders stacked bar 1`] = ` } /> @@ -752,9 +782,14 @@ exports[`xy_expression XYChart component it renders stacked horizontal bar 1`] = } /> diff --git a/x-pack/plugins/lens/public/xy_visualization/index.ts b/x-pack/plugins/lens/public/xy_visualization/index.ts index 77cab1ee21344c..fddcad7989b258 100644 --- a/x-pack/plugins/lens/public/xy_visualization/index.ts +++ b/x-pack/plugins/lens/public/xy_visualization/index.ts @@ -10,7 +10,7 @@ import { ExpressionsSetup } from '../../../../../src/plugins/expressions/public' import { UI_SETTINGS } from '../../../../../src/plugins/data/public'; import { xyVisualization } from './xy_visualization'; import { xyChart, getXyChartRenderer } from './xy_expression'; -import { legendConfig, layerConfig, yAxisConfig } from './types'; +import { legendConfig, layerConfig, yAxisConfig, tickLabelsConfig, gridlinesConfig } from './types'; import { EditorFrameSetup, FormatFactory } from '../types'; import { ChartsPluginSetup } from '../../../../../src/plugins/charts/public'; @@ -39,6 +39,8 @@ export class XyVisualization { ) { expressions.registerFunction(() => legendConfig); expressions.registerFunction(() => yAxisConfig); + expressions.registerFunction(() => tickLabelsConfig); + expressions.registerFunction(() => gridlinesConfig); expressions.registerFunction(() => layerConfig); expressions.registerFunction(() => xyChart); diff --git a/x-pack/plugins/lens/public/xy_visualization/to_expression.test.ts b/x-pack/plugins/lens/public/xy_visualization/to_expression.test.ts index 31b34e41e82db0..876d1141740e16 100644 --- a/x-pack/plugins/lens/public/xy_visualization/to_expression.test.ts +++ b/x-pack/plugins/lens/public/xy_visualization/to_expression.test.ts @@ -41,6 +41,8 @@ describe('#toExpression', () => { legend: { position: Position.Bottom, isVisible: true }, preferredSeriesType: 'bar', fittingFunction: 'Carry', + tickLabelsVisibilitySettings: { x: false, y: true }, + gridlinesVisibilitySettings: { x: false, y: true }, layers: [ { layerId: 'first', @@ -77,6 +79,27 @@ describe('#toExpression', () => { ).toEqual('None'); }); + it('should default the showXAxisTitle and showYAxisTitle to true', () => { + const expression = xyVisualization.toExpression( + { + legend: { position: Position.Bottom, isVisible: true }, + preferredSeriesType: 'bar', + layers: [ + { + layerId: 'first', + seriesType: 'area', + splitAccessor: 'd', + xAccessor: 'a', + accessors: ['b', 'c'], + }, + ], + }, + frame + ) as Ast; + expect(expression.chain[0].arguments.showXAxisTitle[0]).toBe(true); + expect(expression.chain[0].arguments.showYAxisTitle[0]).toBe(true); + }); + it('should not generate an expression when missing x', () => { expect( xyVisualization.toExpression( @@ -140,8 +163,8 @@ describe('#toExpression', () => { expect(mockDatasource.publicAPIMock.getOperationForColumnId).toHaveBeenCalledWith('b'); expect(mockDatasource.publicAPIMock.getOperationForColumnId).toHaveBeenCalledWith('c'); expect(mockDatasource.publicAPIMock.getOperationForColumnId).toHaveBeenCalledWith('d'); - expect(expression.chain[0].arguments.xTitle).toEqual(['col_a']); - expect(expression.chain[0].arguments.yTitle).toEqual(['col_b']); + expect(expression.chain[0].arguments.xTitle).toEqual(['']); + expect(expression.chain[0].arguments.yTitle).toEqual(['']); expect( (expression.chain[0].arguments.layers[0] as Ast).chain[0].arguments.columnToLabel ).toEqual([ @@ -152,4 +175,54 @@ describe('#toExpression', () => { }), ]); }); + + it('should default the tick labels visibility settings to true', () => { + const expression = xyVisualization.toExpression( + { + legend: { position: Position.Bottom, isVisible: true }, + preferredSeriesType: 'bar', + layers: [ + { + layerId: 'first', + seriesType: 'area', + splitAccessor: 'd', + xAccessor: 'a', + accessors: ['b', 'c'], + }, + ], + }, + frame + ) as Ast; + expect( + (expression.chain[0].arguments.tickLabelsVisibilitySettings[0] as Ast).chain[0].arguments + ).toEqual({ + x: [true], + y: [true], + }); + }); + + it('should default the gridlines visibility settings to true', () => { + const expression = xyVisualization.toExpression( + { + legend: { position: Position.Bottom, isVisible: true }, + preferredSeriesType: 'bar', + layers: [ + { + layerId: 'first', + seriesType: 'area', + splitAccessor: 'd', + xAccessor: 'a', + accessors: ['b', 'c'], + }, + ], + }, + frame + ) as Ast; + expect( + (expression.chain[0].arguments.gridlinesVisibilitySettings[0] as Ast).chain[0].arguments + ).toEqual({ + x: [true], + y: [true], + }); + }); }); diff --git a/x-pack/plugins/lens/public/xy_visualization/to_expression.ts b/x-pack/plugins/lens/public/xy_visualization/to_expression.ts index b17704b38cdec0..9b9c159af265e0 100644 --- a/x-pack/plugins/lens/public/xy_visualization/to_expression.ts +++ b/x-pack/plugins/lens/public/xy_visualization/to_expression.ts @@ -13,28 +13,6 @@ interface ValidLayer extends LayerConfig { xAccessor: NonNullable; } -function xyTitles(layer: LayerConfig, frame: FramePublicAPI) { - const defaults = { - xTitle: 'x', - yTitle: 'y', - }; - - if (!layer || !layer.accessors.length) { - return defaults; - } - const datasource = frame.datasourceLayers[layer.layerId]; - if (!datasource) { - return defaults; - } - const x = layer.xAccessor ? datasource.getOperationForColumnId(layer.xAccessor) : null; - const y = layer.accessors[0] ? datasource.getOperationForColumnId(layer.accessors[0]) : null; - - return { - xTitle: x ? x.label : defaults.xTitle, - yTitle: y ? y.label : defaults.yTitle, - }; -} - export const toExpression = (state: State, frame: FramePublicAPI): Ast | null => { if (!state || !state.layers.length) { return null; @@ -52,7 +30,7 @@ export const toExpression = (state: State, frame: FramePublicAPI): Ast | null => }); }); - return buildExpression(state, metadata, frame, xyTitles(state.layers[0], frame)); + return buildExpression(state, metadata, frame); }; export function toPreviewExpression(state: State, frame: FramePublicAPI) { @@ -99,8 +77,7 @@ export function getScaleType(metadata: OperationMetadata | null, defaultScale: S export const buildExpression = ( state: State, metadata: Record>, - frame?: FramePublicAPI, - { xTitle, yTitle }: { xTitle: string; yTitle: string } = { xTitle: '', yTitle: '' } + frame?: FramePublicAPI ): Ast | null => { const validLayers = state.layers.filter((layer): layer is ValidLayer => Boolean(layer.xAccessor && layer.accessors.length) @@ -116,8 +93,8 @@ export const buildExpression = ( type: 'function', function: 'lens_xy_chart', arguments: { - xTitle: [xTitle], - yTitle: [yTitle], + xTitle: [state.xTitle || ''], + yTitle: [state.yTitle || ''], legend: [ { type: 'expression', @@ -137,6 +114,38 @@ export const buildExpression = ( }, ], fittingFunction: [state.fittingFunction || 'None'], + showXAxisTitle: [state.showXAxisTitle ?? true], + showYAxisTitle: [state.showYAxisTitle ?? true], + tickLabelsVisibilitySettings: [ + { + type: 'expression', + chain: [ + { + type: 'function', + function: 'lens_xy_tickLabelsConfig', + arguments: { + x: [state?.tickLabelsVisibilitySettings?.x ?? true], + y: [state?.tickLabelsVisibilitySettings?.y ?? true], + }, + }, + ], + }, + ], + gridlinesVisibilitySettings: [ + { + type: 'expression', + chain: [ + { + type: 'function', + function: 'lens_xy_gridlinesConfig', + arguments: { + x: [state?.gridlinesVisibilitySettings?.x ?? true], + y: [state?.gridlinesVisibilitySettings?.y ?? true], + }, + }, + ], + }, + ], layers: validLayers.map((layer) => { const columnToLabel: Record = {}; diff --git a/x-pack/plugins/lens/public/xy_visualization/types.ts b/x-pack/plugins/lens/public/xy_visualization/types.ts index 605119535d1f0a..ab689ceb183bea 100644 --- a/x-pack/plugins/lens/public/xy_visualization/types.ts +++ b/x-pack/plugins/lens/public/xy_visualization/types.ts @@ -75,6 +75,81 @@ export const legendConfig: ExpressionFunctionDefinition< }, }; +export interface AxesSettingsConfig { + x: boolean; + y: boolean; +} + +type TickLabelsConfigResult = AxesSettingsConfig & { type: 'lens_xy_tickLabelsConfig' }; + +export const tickLabelsConfig: ExpressionFunctionDefinition< + 'lens_xy_tickLabelsConfig', + null, + AxesSettingsConfig, + TickLabelsConfigResult +> = { + name: 'lens_xy_tickLabelsConfig', + aliases: [], + type: 'lens_xy_tickLabelsConfig', + help: `Configure the xy chart's tick labels appearance`, + inputTypes: ['null'], + args: { + x: { + types: ['boolean'], + help: i18n.translate('xpack.lens.xyChart.xAxisTickLabels.help', { + defaultMessage: 'Specifies whether or not the tick labels of the x-axis are visible.', + }), + }, + y: { + types: ['boolean'], + help: i18n.translate('xpack.lens.xyChart.yAxisTickLabels.help', { + defaultMessage: 'Specifies whether or not the tick labels of the y-axis are visible.', + }), + }, + }, + fn: function fn(input: unknown, args: AxesSettingsConfig) { + return { + type: 'lens_xy_tickLabelsConfig', + ...args, + }; + }, +}; + +type GridlinesConfigResult = AxesSettingsConfig & { type: 'lens_xy_gridlinesConfig' }; + +export const gridlinesConfig: ExpressionFunctionDefinition< + 'lens_xy_gridlinesConfig', + null, + AxesSettingsConfig, + GridlinesConfigResult +> = { + name: 'lens_xy_gridlinesConfig', + aliases: [], + type: 'lens_xy_gridlinesConfig', + help: `Configure the xy chart's gridlines appearance`, + inputTypes: ['null'], + args: { + x: { + types: ['boolean'], + help: i18n.translate('xpack.lens.xyChart.xAxisGridlines.help', { + defaultMessage: 'Specifies whether or not the gridlines of the x-axis are visible.', + }), + }, + y: { + types: ['boolean'], + help: i18n.translate('xpack.lens.xyChart.yAxisgridlines.help', { + defaultMessage: 'Specifies whether or not the gridlines of the y-axis are visible.', + }), + }, + }, + fn: function fn(input: unknown, args: AxesSettingsConfig) { + return { + type: 'lens_xy_gridlinesConfig', + ...args, + }; + }, +}; + interface AxisConfig { title: string; hide?: boolean; @@ -243,6 +318,10 @@ export interface XYArgs { legend: LegendConfig & { type: 'lens_xy_legendConfig' }; layers: LayerArgs[]; fittingFunction?: FittingFunction; + showXAxisTitle?: boolean; + showYAxisTitle?: boolean; + tickLabelsVisibilitySettings?: AxesSettingsConfig & { type: 'lens_xy_tickLabelsConfig' }; + gridlinesVisibilitySettings?: AxesSettingsConfig & { type: 'lens_xy_gridlinesConfig' }; } // Persisted parts of the state @@ -251,6 +330,12 @@ export interface XYState { legend: LegendConfig; fittingFunction?: FittingFunction; layers: LayerConfig[]; + xTitle?: string; + yTitle?: string; + showXAxisTitle?: boolean; + showYAxisTitle?: boolean; + tickLabelsVisibilitySettings?: AxesSettingsConfig; + gridlinesVisibilitySettings?: AxesSettingsConfig; } export type State = XYState; diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel.test.tsx b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel.test.tsx index 375eaf736cc958..31ba1bc83d970c 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel.test.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel.test.tsx @@ -109,7 +109,6 @@ describe('XY Config panels', () => { it('should disable the select if there is no unstacked area or line series', () => { const state = testState(); - const component = shallow( { expect(component.find(EuiSuperSelect).prop('disabled')).toEqual(true); }); + + it('should show the values of the X and Y axes titles on the corresponding input text', () => { + const state = testState(); + const component = shallow( + + ); + + expect(component.find('[data-test-subj="lnsXAxisTitle"]').prop('value')).toBe( + 'My custom X axis title' + ); + expect(component.find('[data-test-subj="lnsYAxisTitle"]').prop('value')).toBe( + 'My custom Y axis title' + ); + }); + + it('should disable the input texts if the switch is off', () => { + const state = testState(); + const component = shallow( + + ); + + expect(component.find('[data-test-subj="lnsXAxisTitle"]').prop('disabled')).toBe(true); + expect(component.find('[data-test-subj="lnsYAxisTitle"]').prop('disabled')).toBe(true); + }); + + it('has the tick labels buttons enabled', () => { + const state = testState(); + const component = shallow(); + + const options = component + .find('[data-test-subj="lnsTickLabelsSettings"]') + .prop('options') as EuiButtonGroupProps['options']; + + expect(options!.map(({ label }) => label)).toEqual(['X-axis', 'Y-axis']); + + const selections = component + .find('[data-test-subj="lnsTickLabelsSettings"]') + .prop('idToSelectedMap'); + + expect(selections!).toEqual({ x: true, y: true }); + }); + + it('has the gridlines buttons enabled', () => { + const state = testState(); + const component = shallow(); + + const selections = component + .find('[data-test-subj="lnsGridlinesSettings"]') + .prop('idToSelectedMap'); + + expect(selections!).toEqual({ x: true, y: true }); + }); }); }); diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel.tsx b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel.tsx index e4bc6de5cc68ae..d64eb9451a50ee 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel.tsx @@ -5,7 +5,7 @@ */ import './xy_config_panel.scss'; -import React, { useState } from 'react'; +import React, { useState, useEffect, useCallback } from 'react'; import { i18n } from '@kbn/i18n'; import { Position } from '@elastic/charts'; import { debounce } from 'lodash'; @@ -24,14 +24,17 @@ import { EuiColorPickerProps, EuiToolTip, EuiIcon, + EuiFieldText, + EuiSwitch, EuiHorizontalRule, + EuiTitle, } from '@elastic/eui'; import { VisualizationLayerWidgetProps, VisualizationDimensionEditorProps, VisualizationToolbarProps, } from '../types'; -import { State, SeriesType, visualizationTypes, YAxisMode } from './types'; +import { State, SeriesType, visualizationTypes, YAxisMode, AxesSettingsConfig } from './types'; import { isHorizontalChart, isHorizontalSeries, getSeriesColor } from './state_helpers'; import { trackUiEvent } from '../lens_ui_telemetry'; import { fittingFunctionDefinitions } from './fitting_functions'; @@ -118,14 +121,117 @@ export function LayerContextMenu(props: VisualizationLayerWidgetProps) { } export function XyToolbar(props: VisualizationToolbarProps) { + const axes = [ + { + id: 'x', + label: 'X-axis', + }, + { + id: 'y', + label: 'Y-axis', + }, + ]; + + const { frame, state, setState } = props; + const [open, setOpen] = useState(false); - const hasNonBarSeries = props.state?.layers.some( + const hasNonBarSeries = state?.layers.some( (layer) => layer.seriesType === 'line' || layer.seriesType === 'area' ); + + const [xAxisTitle, setXAxisTitle] = useState(state?.xTitle); + const [yAxisTitle, setYAxisTitle] = useState(state?.yTitle); + + const xyTitles = useCallback(() => { + const defaults = { + xTitle: xAxisTitle, + yTitle: yAxisTitle, + }; + const layer = state?.layers[0]; + if (!layer || !layer.accessors.length) { + return defaults; + } + const datasource = frame.datasourceLayers[layer.layerId]; + if (!datasource) { + return defaults; + } + const x = layer.xAccessor ? datasource.getOperationForColumnId(layer.xAccessor) : null; + const y = layer.accessors[0] ? datasource.getOperationForColumnId(layer.accessors[0]) : null; + + return { + xTitle: defaults.xTitle || x?.label, + yTitle: defaults.yTitle || y?.label, + }; + /* We want this callback to run only if open changes its state. What we want to accomplish here is to give the user a better UX. + By default these input fields have the axis legends. If the user changes the input text, the axis legends should also change. + BUT if the user cleans up the input text, it should remain empty until the user closes and reopens the panel. + In that case, the default axes legend should appear. */ + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [open]); + + useEffect(() => { + const { + xTitle, + yTitle, + }: { xTitle: string | undefined; yTitle: string | undefined } = xyTitles(); + setXAxisTitle(xTitle); + setYAxisTitle(yTitle); + }, [xyTitles]); + + const onXTitleChange = (value: string): void => { + setXAxisTitle(value); + setState({ ...state, xTitle: value }); + }; + + const onYTitleChange = (value: string): void => { + setYAxisTitle(value); + setState({ ...state, yTitle: value }); + }; + + type AxesSettingsConfigKeys = keyof AxesSettingsConfig; + + const tickLabelsVisibilitySettings = { + x: state?.tickLabelsVisibilitySettings?.x ?? true, + y: state?.tickLabelsVisibilitySettings?.y ?? true, + }; + + const onTickLabelsVisibilitySettingsChange = (optionId: string): void => { + const id = optionId as AxesSettingsConfigKeys; + const newTickLabelsVisibilitySettings = { + ...tickLabelsVisibilitySettings, + ...{ + [id]: !tickLabelsVisibilitySettings[id], + }, + }; + setState({ + ...state, + tickLabelsVisibilitySettings: newTickLabelsVisibilitySettings, + }); + }; + + const gridlinesVisibilitySettings = { + x: state?.gridlinesVisibilitySettings?.x ?? true, + y: state?.gridlinesVisibilitySettings?.y ?? true, + }; + + const onGridlinesVisibilitySettingsChange = (optionId: string): void => { + const id = optionId as AxesSettingsConfigKeys; + const newGridlinesVisibilitySettings = { + ...gridlinesVisibilitySettings, + ...{ + [id]: !gridlinesVisibilitySettings[id], + }, + }; + setState({ + ...state, + gridlinesVisibilitySettings: newGridlinesVisibilitySettings, + }); + }; + const legendMode = - props.state?.legend.isVisible && !props.state?.legend.showSingleSeries + state?.legend.isVisible && !state?.legend.showSingleSeries ? 'auto' - : !props.state?.legend.isVisible + : !state?.legend.isVisible ? 'hide' : 'show'; return ( @@ -183,8 +289,8 @@ export function XyToolbar(props: VisualizationToolbarProps) { inputDisplay: title, }; })} - valueOfSelected={props.state?.fittingFunction || 'None'} - onChange={(value) => props.setState({ ...props.state, fittingFunction: value })} + valueOfSelected={state?.fittingFunction || 'None'} + onChange={(value) => setState({ ...state, fittingFunction: value })} itemLayoutAlign="top" hasDividers /> @@ -209,19 +315,19 @@ export function XyToolbar(props: VisualizationToolbarProps) { onChange={(optionId) => { const newMode = legendOptions.find(({ id }) => id === optionId)!.value; if (newMode === 'auto') { - props.setState({ - ...props.state, - legend: { ...props.state.legend, isVisible: true, showSingleSeries: false }, + setState({ + ...state, + legend: { ...state.legend, isVisible: true, showSingleSeries: false }, }); } else if (newMode === 'show') { - props.setState({ - ...props.state, - legend: { ...props.state.legend, isVisible: true, showSingleSeries: true }, + setState({ + ...state, + legend: { ...state.legend, isVisible: true, showSingleSeries: true }, }); } else if (newMode === 'hide') { - props.setState({ - ...props.state, - legend: { ...props.state.legend, isVisible: false, showSingleSeries: false }, + setState({ + ...state, + legend: { ...state.legend, isVisible: false, showSingleSeries: false }, }); } }} @@ -242,15 +348,130 @@ export function XyToolbar(props: VisualizationToolbarProps) { { value: Position.Right, text: 'Right' }, { value: Position.Bottom, text: 'Bottom' }, ]} - value={props.state?.legend.position} + value={state?.legend.position} onChange={(e) => { - props.setState({ - ...props.state, - legend: { ...props.state.legend, position: e.target.value as Position }, + setState({ + ...state, + legend: { ...state.legend, position: e.target.value as Position }, }); }} /> + + + onTickLabelsVisibilitySettingsChange(id)} + buttonSize="compressed" + isFullWidth + type="multi" + /> + + + onGridlinesVisibilitySettingsChange(id)} + buttonSize="compressed" + isFullWidth + type="multi" + /> + + + + + {i18n.translate('xpack.lens.xyChart.axisTitles', { defaultMessage: 'Axis titles' })} + + + + X-axis + + + setState({ ...state, showXAxisTitle: target.checked }) + } + checked={state?.showXAxisTitle ?? true} + /> + + + } + > + onXTitleChange(target.value)} + aria-label={i18n.translate('xpack.lens.xyChart.overwriteXaxis', { + defaultMessage: 'Overwrite X-axis title', + })} + /> + + + Y-axis + + + setState({ ...state, showYAxisTitle: target.checked }) + } + checked={state?.showYAxisTitle ?? true} + /> + + + } + > + onYTitleChange(target.value)} + aria-label={i18n.translate('xpack.lens.xyChart.overwriteYaxis', { + defaultMessage: 'Overwrite Y-axis title', + })} + /> + diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_expression.test.tsx b/x-pack/plugins/lens/public/xy_visualization/xy_expression.test.tsx index c880cbb641e5d7..ba1ff6a1df030c 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_expression.test.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/xy_expression.test.tsx @@ -22,7 +22,16 @@ import { LensMultiTable } from '../types'; import { KibanaDatatable, KibanaDatatableRow } from '../../../../../src/plugins/expressions/public'; import React from 'react'; import { shallow } from 'enzyme'; -import { XYArgs, LegendConfig, legendConfig, layerConfig, LayerArgs } from './types'; +import { + XYArgs, + LegendConfig, + legendConfig, + layerConfig, + LayerArgs, + AxesSettingsConfig, + tickLabelsConfig, + gridlinesConfig, +} from './types'; import { createMockExecutionContext } from '../../../../../src/plugins/expressions/common/mocks'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; import { chartPluginMock } from '../../../../../src/plugins/charts/public/mocks'; @@ -211,6 +220,18 @@ const createArgsWithLayers = (layers: LayerArgs[] = [sampleLayer]): XYArgs => ({ isVisible: false, position: Position.Top, }, + showXAxisTitle: true, + showYAxisTitle: true, + tickLabelsVisibilitySettings: { + type: 'lens_xy_tickLabelsConfig', + x: true, + y: false, + }, + gridlinesVisibilitySettings: { + type: 'lens_xy_gridlinesConfig', + x: true, + y: false, + }, layers, }); @@ -267,6 +288,34 @@ describe('xy_expression', () => { }); }); + test('tickLabelsConfig produces the correct arguments', () => { + const args: AxesSettingsConfig = { + x: true, + y: false, + }; + + const result = tickLabelsConfig.fn(null, args, createMockExecutionContext()); + + expect(result).toEqual({ + type: 'lens_xy_tickLabelsConfig', + ...args, + }); + }); + + test('gridlinesConfig produces the correct arguments', () => { + const args: AxesSettingsConfig = { + x: true, + y: false, + }; + + const result = gridlinesConfig.fn(null, args, createMockExecutionContext()); + + expect(result).toEqual({ + type: 'lens_xy_gridlinesConfig', + ...args, + }); + }); + describe('xyChart', () => { test('it renders with the specified data and args', () => { const { data, args } = sampleArgs(); @@ -1365,6 +1414,35 @@ describe('xy_expression', () => { expect(convertSpy).toHaveBeenCalledWith('I'); }); + test('it should not pass the formatter function to the x axis if the visibility of the tick labels is off', () => { + const { data, args } = sampleArgs(); + + args.tickLabelsVisibilitySettings = { x: false, y: true, type: 'lens_xy_tickLabelsConfig' }; + + const instance = shallow( + + ); + + const tickFormatter = instance.find(Axis).first().prop('tickFormat'); + + if (!tickFormatter) { + throw new Error('tickFormatter prop not found'); + } + + tickFormatter('I'); + + expect(convertSpy).toHaveBeenCalledTimes(0); + }); + test('it should remove invalid rows', () => { const data: LensMultiTable = { type: 'lens_multitable', @@ -1400,6 +1478,16 @@ describe('xy_expression', () => { xTitle: '', yTitle: '', legend: { type: 'lens_xy_legendConfig', isVisible: false, position: Position.Top }, + tickLabelsVisibilitySettings: { + type: 'lens_xy_tickLabelsConfig', + x: true, + y: true, + }, + gridlinesVisibilitySettings: { + type: 'lens_xy_gridlinesConfig', + x: true, + y: false, + }, layers: [ { layerId: 'first', @@ -1469,6 +1557,16 @@ describe('xy_expression', () => { xTitle: '', yTitle: '', legend: { type: 'lens_xy_legendConfig', isVisible: false, position: Position.Top }, + tickLabelsVisibilitySettings: { + type: 'lens_xy_tickLabelsConfig', + x: true, + y: false, + }, + gridlinesVisibilitySettings: { + type: 'lens_xy_gridlinesConfig', + x: true, + y: false, + }, layers: [ { layerId: 'first', @@ -1525,6 +1623,16 @@ describe('xy_expression', () => { xTitle: '', yTitle: '', legend: { type: 'lens_xy_legendConfig', isVisible: true, position: Position.Top }, + tickLabelsVisibilitySettings: { + type: 'lens_xy_tickLabelsConfig', + x: true, + y: false, + }, + gridlinesVisibilitySettings: { + type: 'lens_xy_gridlinesConfig', + x: true, + y: false, + }, layers: [ { layerId: 'first', @@ -1683,5 +1791,68 @@ describe('xy_expression', () => { expect(component.find(LineSeries).prop('fit')).toEqual({ type: Fit.None }); }); + + test('it should apply the xTitle if is specified', () => { + const { data, args } = sampleArgs(); + + args.xTitle = 'My custom x-axis title'; + + const component = shallow( + + ); + + expect(component.find(Axis).at(0).prop('title')).toEqual('My custom x-axis title'); + }); + + test('it should hide the X axis title if the corresponding switch is off', () => { + const { data, args } = sampleArgs(); + + args.showXAxisTitle = false; + + const component = shallow( + + ); + + expect(component.find(Axis).at(0).prop('title')).toEqual(undefined); + }); + + test('it should show the X axis gridlines if the setting is on', () => { + const { data, args } = sampleArgs(); + + args.gridlinesVisibilitySettings = { x: true, y: false, type: 'lens_xy_gridlinesConfig' }; + + const component = shallow( + + ); + + expect(component.find(Axis).at(0).prop('showGridLines')).toBeTruthy(); + }); }); }); diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_expression.tsx b/x-pack/plugins/lens/public/xy_visualization/xy_expression.tsx index a3468e109e75bc..2037a3dbe6623b 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_expression.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/xy_expression.tsx @@ -102,6 +102,30 @@ export const xyChart: ExpressionFunctionDefinition< defaultMessage: 'Define how missing values are treated', }), }, + tickLabelsVisibilitySettings: { + types: ['lens_xy_tickLabelsConfig'], + help: i18n.translate('xpack.lens.xyChart.tickLabelsSettings.help', { + defaultMessage: 'Show x and y axes tick labels', + }), + }, + gridlinesVisibilitySettings: { + types: ['lens_xy_gridlinesConfig'], + help: i18n.translate('xpack.lens.xyChart.gridlinesSettings.help', { + defaultMessage: 'Show x and y axes gridlines', + }), + }, + showXAxisTitle: { + types: ['boolean'], + help: i18n.translate('xpack.lens.xyChart.showXAxisTitle.help', { + defaultMessage: 'Show x axis title', + }), + }, + showYAxisTitle: { + types: ['boolean'], + help: i18n.translate('xpack.lens.xyChart.showYAxisTitle.help', { + defaultMessage: 'Show y axis title', + }), + }, layers: { // eslint-disable-next-line @typescript-eslint/no-explicit-any types: ['lens_xy_layer'] as any, @@ -199,7 +223,7 @@ export function XYChart({ onClickValue, onSelectRange, }: XYChartRenderProps) { - const { legend, layers, fittingFunction } = args; + const { legend, layers, fittingFunction, gridlinesVisibilitySettings } = args; const chartTheme = chartsThemeService.useChartsTheme(); const chartBaseTheme = chartsThemeService.useChartsBaseTheme(); @@ -237,7 +261,10 @@ export function XYChart({ shouldRotate ); - const xTitle = (xAxisColumn && xAxisColumn.name) || args.xTitle; + const xTitle = args.xTitle || (xAxisColumn && xAxisColumn.name); + const showXAxisTitle = args.showXAxisTitle ?? true; + const showYAxisTitle = args.showYAxisTitle ?? true; + const tickLabelsVisibilitySettings = args.tickLabelsVisibilitySettings || { x: true, y: true }; function calculateMinInterval() { // check all the tables to see if all of the rows have the same timestamp @@ -279,6 +306,22 @@ export function XYChart({ } : undefined; + const getYAxesTitles = ( + axisSeries: Array<{ layer: string; accessor: string }>, + index: number + ) => { + if (index > 0 && args.yTitle) return; + return ( + args.yTitle || + axisSeries + .map( + (series) => + data.tables[series.layer].columns.find((column) => column.id === series.accessor)?.name + ) + .filter((name) => Boolean(name))[0] + ); + }; + return ( xAxisFormatter.convert(d)} + tickFormat={tickLabelsVisibilitySettings?.x ? (d) => xAxisFormatter.convert(d) : () => ''} /> {yAxesConfiguration.map((axis, index) => ( @@ -389,18 +433,10 @@ export function XYChart({ id={axis.groupId} groupId={axis.groupId} position={axis.position} - title={ - axis.series - .map( - (series) => - data.tables[series.layer].columns.find((column) => column.id === series.accessor) - ?.name - ) - .filter((name) => Boolean(name))[0] || args.yTitle - } - showGridLines={false} + title={showYAxisTitle ? getYAxesTitles(axis.series, index) : undefined} + showGridLines={gridlinesVisibilitySettings?.y} hide={filteredLayers[0].hide} - tickFormat={(d) => axis.formatter.convert(d)} + tickFormat={tickLabelsVisibilitySettings?.y ? (d) => axis.formatter.convert(d) : () => ''} /> ))} diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_suggestions.test.ts b/x-pack/plugins/lens/public/xy_visualization/xy_suggestions.test.ts index 7b3398658a5000..632f6fc8861a4f 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_suggestions.test.ts +++ b/x-pack/plugins/lens/public/xy_visualization/xy_suggestions.test.ts @@ -445,6 +445,10 @@ describe('xy_suggestions', () => { const currentState: XYState = { legend: { isVisible: true, position: 'bottom' }, fittingFunction: 'None', + showXAxisTitle: true, + showYAxisTitle: true, + gridlinesVisibilitySettings: { x: true, y: true }, + tickLabelsVisibilitySettings: { x: true, y: false }, preferredSeriesType: 'bar', layers: [ { @@ -483,6 +487,10 @@ describe('xy_suggestions', () => { legend: { isVisible: true, position: 'bottom' }, preferredSeriesType: 'bar', fittingFunction: 'None', + showXAxisTitle: true, + showYAxisTitle: true, + gridlinesVisibilitySettings: { x: true, y: true }, + tickLabelsVisibilitySettings: { x: true, y: false }, layers: [ { accessors: ['price', 'quantity'], @@ -592,6 +600,10 @@ describe('xy_suggestions', () => { legend: { isVisible: true, position: 'bottom' }, preferredSeriesType: 'bar', fittingFunction: 'None', + showXAxisTitle: true, + showYAxisTitle: true, + gridlinesVisibilitySettings: { x: true, y: true }, + tickLabelsVisibilitySettings: { x: true, y: false }, layers: [ { accessors: ['price', 'quantity'], @@ -631,6 +643,10 @@ describe('xy_suggestions', () => { legend: { isVisible: true, position: 'bottom' }, preferredSeriesType: 'bar', fittingFunction: 'None', + showXAxisTitle: true, + showYAxisTitle: true, + gridlinesVisibilitySettings: { x: true, y: true }, + tickLabelsVisibilitySettings: { x: true, y: false }, layers: [ { accessors: ['price'], @@ -671,6 +687,10 @@ describe('xy_suggestions', () => { legend: { isVisible: true, position: 'bottom' }, preferredSeriesType: 'bar', fittingFunction: 'None', + showXAxisTitle: true, + showYAxisTitle: true, + gridlinesVisibilitySettings: { x: true, y: true }, + tickLabelsVisibilitySettings: { x: true, y: false }, layers: [ { accessors: ['price', 'quantity'], diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_suggestions.ts b/x-pack/plugins/lens/public/xy_visualization/xy_suggestions.ts index 1be8d566a8b64b..387d56c03e31a7 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_suggestions.ts +++ b/x-pack/plugins/lens/public/xy_visualization/xy_suggestions.ts @@ -407,6 +407,18 @@ function buildSuggestion({ const state: State = { legend: currentState ? currentState.legend : { isVisible: true, position: Position.Right }, fittingFunction: currentState?.fittingFunction || 'None', + xTitle: currentState?.xTitle, + yTitle: currentState?.yTitle, + showXAxisTitle: currentState?.showXAxisTitle ?? true, + showYAxisTitle: currentState?.showYAxisTitle ?? true, + tickLabelsVisibilitySettings: currentState?.tickLabelsVisibilitySettings || { + x: true, + y: true, + }, + gridlinesVisibilitySettings: currentState?.gridlinesVisibilitySettings || { + x: true, + y: true, + }, preferredSeriesType: seriesType, layers: Object.keys(existingLayer).length ? keptLayers : [...keptLayers, newLayer], }; diff --git a/x-pack/plugins/lists/common/constants.mock.ts b/x-pack/plugins/lists/common/constants.mock.ts index b7609b5a3602a5..428cc90d2908b8 100644 --- a/x-pack/plugins/lists/common/constants.mock.ts +++ b/x-pack/plugins/lists/common/constants.mock.ts @@ -9,6 +9,7 @@ import { EntriesArray } from './schemas/types'; export const DATE_NOW = '2020-04-20T15:25:31.830Z'; export const OLD_DATE_RELATIVE_TO_DATE_NOW = '2020-04-19T15:25:31.830Z'; export const USER = 'some user'; +export const ELASTIC_USER = 'elastic'; export const LIST_INDEX = '.lists'; export const LIST_ITEM_INDEX = '.items'; export const NAME = 'some name'; diff --git a/x-pack/plugins/lists/common/schemas/request/create_list_item_schema.mock.ts b/x-pack/plugins/lists/common/schemas/request/create_list_item_schema.mock.ts index f0d4af520bdbbe..5a9e50554865bf 100644 --- a/x-pack/plugins/lists/common/schemas/request/create_list_item_schema.mock.ts +++ b/x-pack/plugins/lists/common/schemas/request/create_list_item_schema.mock.ts @@ -14,3 +14,20 @@ export const getCreateListItemSchemaMock = (): CreateListItemSchema => ({ meta: META, value: VALUE, }); + +/** + * Useful for end to end testing + */ +export const getCreateMinimalListItemSchemaMock = (): CreateListItemSchema => ({ + id: LIST_ITEM_ID, + list_id: LIST_ID, + value: VALUE, +}); + +/** + * Useful for end to end testing + */ +export const getCreateMinimalListItemSchemaMockWithoutId = (): CreateListItemSchema => ({ + list_id: LIST_ID, + value: VALUE, +}); diff --git a/x-pack/plugins/lists/common/schemas/request/create_list_schema.mock.ts b/x-pack/plugins/lists/common/schemas/request/create_list_schema.mock.ts index 461890b944bfa3..194625c09fb79d 100644 --- a/x-pack/plugins/lists/common/schemas/request/create_list_schema.mock.ts +++ b/x-pack/plugins/lists/common/schemas/request/create_list_schema.mock.ts @@ -18,3 +18,22 @@ export const getCreateListSchemaMock = (): CreateListSchema => ({ type: TYPE, version: VERSION, }); + +/** + * Useful for end to end tests and other mechanisms which want to fill in the values + */ +export const getCreateMinimalListSchemaMock = (): CreateListSchema => ({ + description: DESCRIPTION, + id: LIST_ID, + name: NAME, + type: TYPE, +}); + +/** + * Useful for end to end tests and other mechanisms which want to fill in the values + */ +export const getCreateMinimalListSchemaMockWithoutId = (): CreateListSchema => ({ + description: DESCRIPTION, + name: NAME, + type: TYPE, +}); diff --git a/x-pack/plugins/lists/common/schemas/request/import_list_item_schema.mock.ts b/x-pack/plugins/lists/common/schemas/request/import_list_item_schema.mock.ts index 69e4d2f8293c77..57bb66f746f674 100644 --- a/x-pack/plugins/lists/common/schemas/request/import_list_item_schema.mock.ts +++ b/x-pack/plugins/lists/common/schemas/request/import_list_item_schema.mock.ts @@ -9,3 +9,12 @@ import { ImportListItemSchema } from './import_list_item_schema'; export const getImportListItemSchemaMock = (): ImportListItemSchema => ({ file: {}, }); + +/** + * This is useful for end to end tests, it will return a buffer given a string array + * of things to import. + * @param input Array of strings of things to import + */ +export const getImportListItemAsBuffer = (input: string[]): Buffer => { + return Buffer.from(input.join('\r\n')); +}; diff --git a/x-pack/plugins/lists/common/schemas/request/update_list_item_schema.mock.ts b/x-pack/plugins/lists/common/schemas/request/update_list_item_schema.mock.ts index c95de1e99b4f0d..be8ba3516a7544 100644 --- a/x-pack/plugins/lists/common/schemas/request/update_list_item_schema.mock.ts +++ b/x-pack/plugins/lists/common/schemas/request/update_list_item_schema.mock.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ID, META, VALUE } from '../../constants.mock'; +import { ID, LIST_ITEM_ID, META, VALUE } from '../../constants.mock'; import { UpdateListItemSchema } from './update_list_item_schema'; @@ -13,3 +13,11 @@ export const getUpdateListItemSchemaMock = (): UpdateListItemSchema => ({ meta: META, value: VALUE, }); + +/** + * Useful for end to end testing + */ +export const getUpdateMinimalListItemSchemaMock = (): UpdateListItemSchema => ({ + id: LIST_ITEM_ID, + value: VALUE, +}); diff --git a/x-pack/plugins/lists/common/schemas/request/update_list_schema.mock.ts b/x-pack/plugins/lists/common/schemas/request/update_list_schema.mock.ts new file mode 100644 index 00000000000000..b044d40a5d88f6 --- /dev/null +++ b/x-pack/plugins/lists/common/schemas/request/update_list_schema.mock.ts @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { DESCRIPTION, LIST_ID, META, NAME, _VERSION } from '../../constants.mock'; + +import { UpdateListSchema } from './update_list_schema'; + +export const getUpdateListSchemaMock = (): UpdateListSchema => ({ + _version: _VERSION, + description: DESCRIPTION, + id: LIST_ID, + meta: META, + name: NAME, +}); + +/** + * Useful for end to end tests and other mechanisms which want to fill in the values + * after doing a get of the structure. + */ +export const getUpdateMinimalListSchemaMock = (): UpdateListSchema => ({ + description: DESCRIPTION, + id: LIST_ID, + name: NAME, +}); diff --git a/x-pack/plugins/lists/common/schemas/request/update_list_schema.test.ts b/x-pack/plugins/lists/common/schemas/request/update_list_schema.test.ts new file mode 100644 index 00000000000000..21d20a6b85bce6 --- /dev/null +++ b/x-pack/plugins/lists/common/schemas/request/update_list_schema.test.ts @@ -0,0 +1,48 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { left } from 'fp-ts/lib/Either'; +import { pipe } from 'fp-ts/lib/pipeable'; + +import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports'; + +import { UpdateListSchema, updateListSchema } from './update_list_schema'; +import { getUpdateListSchemaMock } from './update_list_schema.mock'; + +describe('update_list_schema', () => { + test('it should validate a typical list request', () => { + const payload = getUpdateListSchemaMock(); + const decoded = updateListSchema.decode(payload); + const checked = exactCheck(payload, decoded); + const message = pipe(checked, foldLeftRight); + expect(getPaths(left(message.errors))).toEqual([]); + expect(message.schema).toEqual(payload); + }); + + test('it should accept an undefined for "meta" but strip it out', () => { + const payload = getUpdateListSchemaMock(); + const outputPayload = getUpdateListSchemaMock(); + delete payload.meta; + const decoded = updateListSchema.decode(payload); + const checked = exactCheck(payload, decoded); + const message = pipe(checked, foldLeftRight); + delete outputPayload.meta; + expect(getPaths(left(message.errors))).toEqual([]); + expect(message.schema).toEqual(outputPayload); + }); + + test('it should not allow an extra key to be sent in', () => { + const payload: UpdateListSchema & { + extraKey?: string; + } = getUpdateListSchemaMock(); + payload.extraKey = 'some new value'; + const decoded = updateListSchema.decode(payload); + const checked = exactCheck(payload, decoded); + const message = pipe(checked, foldLeftRight); + expect(getPaths(left(message.errors))).toEqual(['invalid keys "extraKey"']); + expect(message.schema).toEqual({}); + }); +}); diff --git a/x-pack/plugins/lists/common/schemas/response/list_item_schema.mock.ts b/x-pack/plugins/lists/common/schemas/response/list_item_schema.mock.ts index e122f6a2bbe3b1..f4e36d1d060c06 100644 --- a/x-pack/plugins/lists/common/schemas/response/list_item_schema.mock.ts +++ b/x-pack/plugins/lists/common/schemas/response/list_item_schema.mock.ts @@ -7,6 +7,7 @@ import { ListItemSchema } from '../../../common/schemas'; import { DATE_NOW, + ELASTIC_USER, LIST_ID, LIST_ITEM_ID, META, @@ -31,3 +32,15 @@ export const getListItemResponseMock = (): ListItemSchema => ({ updated_by: USER, value: VALUE, }); + +/** + * This is useful for end to end tests where we remove the auto generated parts for comparisons + * such as created_at, updated_at, and id. + */ +export const getListItemResponseMockWithoutAutoGeneratedValues = (): Partial => ({ + created_by: ELASTIC_USER, + list_id: LIST_ID, + type: TYPE, + updated_by: ELASTIC_USER, + value: VALUE, +}); diff --git a/x-pack/plugins/lists/common/schemas/response/list_schema.mock.ts b/x-pack/plugins/lists/common/schemas/response/list_schema.mock.ts index 900c7ea4322a3f..4ae77e12a8294a 100644 --- a/x-pack/plugins/lists/common/schemas/response/list_schema.mock.ts +++ b/x-pack/plugins/lists/common/schemas/response/list_schema.mock.ts @@ -8,6 +8,7 @@ import { ListSchema } from '../../../common/schemas'; import { DATE_NOW, DESCRIPTION, + ELASTIC_USER, IMMUTABLE, LIST_ID, META, @@ -35,3 +36,17 @@ export const getListResponseMock = (): ListSchema => ({ updated_by: USER, version: VERSION, }); + +/** + * This is useful for end to end tests where we remove the auto generated parts for comparisons + * such as created_at, updated_at, and id. + */ +export const getListResponseMockWithoutAutoGeneratedValues = (): Partial => ({ + created_by: ELASTIC_USER, + description: DESCRIPTION, + immutable: IMMUTABLE, + name: NAME, + type: TYPE, + updated_by: ELASTIC_USER, + version: VERSION, +}); diff --git a/x-pack/plugins/lists/server/routes/create_list_item_route.ts b/x-pack/plugins/lists/server/routes/create_list_item_route.ts index 0a4a1c739ae7c0..bd2828d331d83c 100644 --- a/x-pack/plugins/lists/server/routes/create_list_item_route.ts +++ b/x-pack/plugins/lists/server/routes/create_list_item_route.ts @@ -36,6 +36,15 @@ export const createListItemRoute = (router: IRouter): void => { statusCode: 404, }); } else { + if (id != null) { + const listItem = await lists.getListItem({ id }); + if (listItem != null) { + return siemResponse.error({ + body: `list item id: "${id}" already exists`, + statusCode: 409, + }); + } + } const createdListItem = await lists.createListItem({ deserializer: list.deserializer, id, diff --git a/x-pack/plugins/lists/server/routes/delete_list_item_route.ts b/x-pack/plugins/lists/server/routes/delete_list_item_route.ts index 2284068552485c..fa1adf8a39ed83 100644 --- a/x-pack/plugins/lists/server/routes/delete_list_item_route.ts +++ b/x-pack/plugins/lists/server/routes/delete_list_item_route.ts @@ -33,7 +33,7 @@ export const deleteListItemRoute = (router: IRouter): void => { const deleted = await lists.deleteListItem({ id }); if (deleted == null) { return siemResponse.error({ - body: `list item with id: "${id}" item not found`, + body: `list item with id: "${id}" not found`, statusCode: 404, }); } else { diff --git a/x-pack/plugins/lists/server/routes/import_list_item_route.ts b/x-pack/plugins/lists/server/routes/import_list_item_route.ts index ce5fdaccae2515..d46c943d95fe99 100644 --- a/x-pack/plugins/lists/server/routes/import_list_item_route.ts +++ b/x-pack/plugins/lists/server/routes/import_list_item_route.ts @@ -41,6 +41,13 @@ export const importListItemRoute = (router: IRouter, config: ConfigType): void = const stream = createStreamFromBuffer(request.body); const { deserializer, list_id: listId, serializer, type } = request.query; const lists = getListClient(context); + const listExists = await lists.getListIndexExists(); + if (!listExists) { + return siemResponse.error({ + body: `To import a list item, the index must exist first. Index "${lists.getListIndex()}" does not exist`, + statusCode: 400, + }); + } if (listId != null) { const list = await lists.getList({ id: listId }); if (list == null) { diff --git a/x-pack/plugins/lists/server/routes/patch_list_route.ts b/x-pack/plugins/lists/server/routes/patch_list_route.ts index e33d8d7c9c5986..763f3f495ca177 100644 --- a/x-pack/plugins/lists/server/routes/patch_list_route.ts +++ b/x-pack/plugins/lists/server/routes/patch_list_route.ts @@ -32,7 +32,7 @@ export const patchListRoute = (router: IRouter): void => { const list = await lists.updateList({ _version, description, id, meta, name, version }); if (list == null) { return siemResponse.error({ - body: `list id: "${id}" found found`, + body: `list id: "${id}" not found`, statusCode: 404, }); } else { diff --git a/x-pack/plugins/lists/server/routes/update_exception_list_route.ts b/x-pack/plugins/lists/server/routes/update_exception_list_route.ts index bead10802df4f2..8102210b8430d7 100644 --- a/x-pack/plugins/lists/server/routes/update_exception_list_route.ts +++ b/x-pack/plugins/lists/server/routes/update_exception_list_route.ts @@ -69,7 +69,7 @@ export const updateExceptionListRoute = (router: IRouter): void => { }); if (list == null) { return siemResponse.error({ - body: `exception list id: "${id}" found found`, + body: `exception list id: "${id}" not found`, statusCode: 404, }); } else { diff --git a/x-pack/plugins/lists/server/routes/update_list_route.ts b/x-pack/plugins/lists/server/routes/update_list_route.ts index 816ad13d3770ec..8d7d08be4130b6 100644 --- a/x-pack/plugins/lists/server/routes/update_list_route.ts +++ b/x-pack/plugins/lists/server/routes/update_list_route.ts @@ -32,7 +32,7 @@ export const updateListRoute = (router: IRouter): void => { const list = await lists.updateList({ _version, description, id, meta, name, version }); if (list == null) { return siemResponse.error({ - body: `list id: "${id}" found found`, + body: `list id: "${id}" not found`, statusCode: 404, }); } else { diff --git a/x-pack/plugins/maps/common/constants.ts b/x-pack/plugins/maps/common/constants.ts index cf67ac4dd999f7..eec23f95bb17b4 100644 --- a/x-pack/plugins/maps/common/constants.ts +++ b/x-pack/plugins/maps/common/constants.ts @@ -234,6 +234,7 @@ export enum INITIAL_LOCATION { LAST_SAVED_LOCATION = 'LAST_SAVED_LOCATION', FIXED_LOCATION = 'FIXED_LOCATION', BROWSER_LOCATION = 'BROWSER_LOCATION', + AUTO_FIT_TO_BOUNDS = 'AUTO_FIT_TO_BOUNDS', } export enum LAYER_WIZARD_CATEGORY { diff --git a/x-pack/plugins/maps/public/actions/data_request_actions.ts b/x-pack/plugins/maps/public/actions/data_request_actions.ts index 4c829f8e75c201..a22e8d582bc5e7 100644 --- a/x-pack/plugins/maps/public/actions/data_request_actions.ts +++ b/x-pack/plugins/maps/public/actions/data_request_actions.ts @@ -7,6 +7,7 @@ import { Dispatch } from 'redux'; import bbox from '@turf/bbox'; +import uuid from 'uuid/v4'; import { multiPoint } from '@turf/helpers'; import { FeatureCollection } from 'geojson'; import { MapStoreState } from '../reducers/store'; @@ -133,7 +134,7 @@ export function syncDataForAllLayers() { }; } -export function syncDataForAllJoinLayers() { +function syncDataForAllJoinLayers() { return async (dispatch: Dispatch, getState: () => MapStoreState) => { const syncPromises = getLayerList(getState()) .filter((layer) => { @@ -318,7 +319,7 @@ export function fitToLayerExtent(layerId: string) { }; } -export function fitToDataBounds() { +export function fitToDataBounds(onNoBounds?: () => void) { return async (dispatch: Dispatch, getState: () => MapStoreState) => { const layerList = getFittableLayers(getState()); @@ -365,6 +366,9 @@ export function fitToDataBounds() { } if (!corners.length) { + if (onNoBounds) { + onNoBounds(); + } return; } @@ -374,6 +378,32 @@ export function fitToDataBounds() { }; } +let lastSetQueryCallId: string = ''; +export function autoFitToBounds() { + return async (dispatch: Dispatch) => { + // Method can be triggered before async actions complete + // Use localSetQueryCallId to only continue execution path if method has not been re-triggered. + const localSetQueryCallId = uuid(); + lastSetQueryCallId = localSetQueryCallId; + + // Joins are performed on the client. + // As a result, bounds for join layers must also be performed on the client. + // Therefore join layers need to fetch data prior to auto fitting bounds. + await dispatch(syncDataForAllJoinLayers()); + + if (localSetQueryCallId === lastSetQueryCallId) { + // In cases where there are no bounds, such as no matching documents, fitToDataBounds does not trigger setGotoWithBounds. + // Ensure layer syncing occurs when setGotoWithBounds is not triggered. + function onNoBounds() { + if (localSetQueryCallId === lastSetQueryCallId) { + dispatch(syncDataForAllLayers()); + } + } + dispatch(fitToDataBounds(onNoBounds)); + } + }; +} + function setGotoWithBounds(bounds: MapExtent) { return { type: SET_GOTO, diff --git a/x-pack/plugins/maps/public/actions/layer_actions.ts b/x-pack/plugins/maps/public/actions/layer_actions.ts index 208f6dc6c6f854..472e42129816b5 100644 --- a/x-pack/plugins/maps/public/actions/layer_actions.ts +++ b/x-pack/plugins/maps/public/actions/layer_actions.ts @@ -125,8 +125,6 @@ export function addLayer(layerDescriptor: LayerDescriptor) { }; } -// Do not use when rendering a map. Method exists to enable selectors for getLayerList when -// rendering is not needed. export function addLayerWithoutDataSync(layerDescriptor: LayerDescriptor) { return { type: ADD_LAYER, diff --git a/x-pack/plugins/maps/public/actions/map_actions.ts b/x-pack/plugins/maps/public/actions/map_actions.ts index 7191fb312b211c..08826276c12ad8 100644 --- a/x-pack/plugins/maps/public/actions/map_actions.ts +++ b/x-pack/plugins/maps/public/actions/map_actions.ts @@ -6,7 +6,6 @@ import { Dispatch } from 'redux'; import turfBboxPolygon from '@turf/bbox-polygon'; import turfBooleanContains from '@turf/boolean-contains'; -import uuid from 'uuid/v4'; import { Filter, Query, TimeRange } from 'src/plugins/data/public'; import { MapStoreState } from '../reducers/store'; @@ -44,12 +43,8 @@ import { UPDATE_DRAW_STATE, UPDATE_MAP_SETTING, } from './map_action_constants'; -import { - fitToDataBounds, - syncDataForAllJoinLayers, - syncDataForAllLayers, -} from './data_request_actions'; -import { addLayer } from './layer_actions'; +import { autoFitToBounds, syncDataForAllLayers } from './data_request_actions'; +import { addLayer, addLayerWithoutDataSync } from './layer_actions'; import { MapSettings } from '../reducers/map'; import { DrawState, @@ -57,6 +52,7 @@ import { MapExtent, MapRefreshConfig, } from '../../common/descriptor_types'; +import { INITIAL_LOCATION } from '../../common/constants'; import { scaleBounds } from '../elasticsearch_geo_utils'; export function setMapInitError(errorMessage: string) { @@ -98,13 +94,21 @@ export function mapReady() { type: MAP_READY, }); - getWaitingForMapReadyLayerListRaw(getState()).forEach((layerDescriptor) => { - dispatch(addLayer(layerDescriptor)); - }); - + const waitingForMapReadyLayerList = getWaitingForMapReadyLayerListRaw(getState()); dispatch({ type: CLEAR_WAITING_FOR_MAP_READY_LAYER_LIST, }); + + if (getMapSettings(getState()).initialLocation === INITIAL_LOCATION.AUTO_FIT_TO_BOUNDS) { + waitingForMapReadyLayerList.forEach((layerDescriptor) => { + dispatch(addLayerWithoutDataSync(layerDescriptor)); + }); + dispatch(autoFitToBounds()); + } else { + waitingForMapReadyLayerList.forEach((layerDescriptor) => { + dispatch(addLayer(layerDescriptor)); + }); + } }; } @@ -196,7 +200,6 @@ function generateQueryTimestamp() { return new Date().toISOString(); } -let lastSetQueryCallId: string = ''; export function setQuery({ query, timeFilters, @@ -227,18 +230,7 @@ export function setQuery({ }); if (getMapSettings(getState()).autoFitToDataBounds) { - // Joins are performed on the client. - // As a result, bounds for join layers must also be performed on the client. - // Therefore join layers need to fetch data prior to auto fitting bounds. - const localSetQueryCallId = uuid(); - lastSetQueryCallId = localSetQueryCallId; - await dispatch(syncDataForAllJoinLayers()); - - // setQuery can be triggered before async data fetching completes - // Only continue execution path if setQuery has not been re-triggered. - if (localSetQueryCallId === lastSetQueryCallId) { - dispatch(fitToDataBounds()); - } + dispatch(autoFitToBounds()); } else { await dispatch(syncDataForAllLayers()); } diff --git a/x-pack/plugins/maps/public/connected_components/map/mb/draw_control/draw_control.js b/x-pack/plugins/maps/public/connected_components/map/mb/draw_control/draw_control.js index ac28a2d5d5a6dc..2daa4b2c900f5f 100644 --- a/x-pack/plugins/maps/public/connected_components/map/mb/draw_control/draw_control.js +++ b/x-pack/plugins/maps/public/connected_components/map/mb/draw_control/draw_control.js @@ -18,9 +18,12 @@ import { } from '../../../../elasticsearch_geo_utils'; import { DrawTooltip } from './draw_tooltip'; +const DRAW_RECTANGLE = 'draw_rectangle'; +const DRAW_CIRCLE = 'draw_circle'; + const mbDrawModes = MapboxDraw.modes; -mbDrawModes.draw_rectangle = DrawRectangle; -mbDrawModes.draw_circle = DrawCircle; +mbDrawModes[DRAW_RECTANGLE] = DrawRectangle; +mbDrawModes[DRAW_CIRCLE] = DrawCircle; export class DrawControl extends React.Component { constructor() { @@ -45,8 +48,10 @@ export class DrawControl extends React.Component { this._removeDrawControl(); } + // debounce with zero timeout needed to allow mapbox-draw finish logic to complete + // before _removeDrawControl is called _syncDrawControl = _.debounce(() => { - if (!this.props.mbMap) { + if (!this._isMounted) { return; } @@ -55,7 +60,7 @@ export class DrawControl extends React.Component { } else { this._removeDrawControl(); } - }, 256); + }, 0); _onDraw = (e) => { if (!e.features.length) { @@ -118,7 +123,7 @@ export class DrawControl extends React.Component { }; _removeDrawControl() { - if (!this._mbDrawControlAdded) { + if (!this.props.mbMap || !this._mbDrawControlAdded) { return; } @@ -129,6 +134,10 @@ export class DrawControl extends React.Component { } _updateDrawControl() { + if (!this.props.mbMap) { + return; + } + if (!this._mbDrawControlAdded) { this.props.mbMap.addControl(this._mbDrawControl); this._mbDrawControlAdded = true; @@ -136,11 +145,15 @@ export class DrawControl extends React.Component { this.props.mbMap.on('draw.create', this._onDraw); } - if (this.props.drawState.drawType === DRAW_TYPE.BOUNDS) { - this._mbDrawControl.changeMode('draw_rectangle'); - } else if (this.props.drawState.drawType === DRAW_TYPE.DISTANCE) { - this._mbDrawControl.changeMode('draw_circle'); - } else if (this.props.drawState.drawType === DRAW_TYPE.POLYGON) { + const drawMode = this._mbDrawControl.getMode(); + if (drawMode !== DRAW_RECTANGLE && this.props.drawState.drawType === DRAW_TYPE.BOUNDS) { + this._mbDrawControl.changeMode(DRAW_RECTANGLE); + } else if (drawMode !== DRAW_CIRCLE && this.props.drawState.drawType === DRAW_TYPE.DISTANCE) { + this._mbDrawControl.changeMode(DRAW_CIRCLE); + } else if ( + drawMode !== this._mbDrawControl.modes.DRAW_POLYGON && + this.props.drawState.drawType === DRAW_TYPE.POLYGON + ) { this._mbDrawControl.changeMode(this._mbDrawControl.modes.DRAW_POLYGON); } } diff --git a/x-pack/plugins/maps/public/connected_components/map/mb/get_initial_view.ts b/x-pack/plugins/maps/public/connected_components/map/mb/get_initial_view.ts index b9d446d390ffb8..20fb8186f9870f 100644 --- a/x-pack/plugins/maps/public/connected_components/map/mb/get_initial_view.ts +++ b/x-pack/plugins/maps/public/connected_components/map/mb/get_initial_view.ts @@ -41,5 +41,10 @@ export async function getInitialView( }); } + if (settings.initialLocation === INITIAL_LOCATION.AUTO_FIT_TO_BOUNDS) { + // map bounds pulled from data sources. Just use default map location + return null; + } + return goto && goto.center ? goto.center : null; } diff --git a/x-pack/plugins/maps/public/connected_components/map_settings_panel/__snapshots__/navigation_panel.test.tsx.snap b/x-pack/plugins/maps/public/connected_components/map_settings_panel/__snapshots__/navigation_panel.test.tsx.snap index 18e30d9446e05f..1859c7d8177f8f 100644 --- a/x-pack/plugins/maps/public/connected_components/map_settings_panel/__snapshots__/navigation_panel.test.tsx.snap +++ b/x-pack/plugins/maps/public/connected_components/map_settings_panel/__snapshots__/navigation_panel.test.tsx.snap @@ -75,6 +75,10 @@ exports[`should render 1`] = ` "id": "LAST_SAVED_LOCATION", "label": "Map location at save", }, + Object { + "id": "AUTO_FIT_TO_BOUNDS", + "label": "Auto fit map to data bounds", + }, Object { "id": "FIXED_LOCATION", "label": "Fixed location", @@ -165,6 +169,10 @@ exports[`should render browser location form when initialLocation is BROWSER_LOC "id": "LAST_SAVED_LOCATION", "label": "Map location at save", }, + Object { + "id": "AUTO_FIT_TO_BOUNDS", + "label": "Auto fit map to data bounds", + }, Object { "id": "FIXED_LOCATION", "label": "Fixed location", @@ -275,6 +283,10 @@ exports[`should render fixed location form when initialLocation is FIXED_LOCATIO "id": "LAST_SAVED_LOCATION", "label": "Map location at save", }, + Object { + "id": "AUTO_FIT_TO_BOUNDS", + "label": "Auto fit map to data bounds", + }, Object { "id": "FIXED_LOCATION", "label": "Fixed location", diff --git a/x-pack/plugins/maps/public/connected_components/map_settings_panel/navigation_panel.tsx b/x-pack/plugins/maps/public/connected_components/map_settings_panel/navigation_panel.tsx index 428a50e03515dc..161c0c3576f8f3 100644 --- a/x-pack/plugins/maps/public/connected_components/map_settings_panel/navigation_panel.tsx +++ b/x-pack/plugins/maps/public/connected_components/map_settings_panel/navigation_panel.tsx @@ -41,6 +41,12 @@ const initialLocationOptions = [ defaultMessage: 'Map location at save', }), }, + { + id: INITIAL_LOCATION.AUTO_FIT_TO_BOUNDS, + label: i18n.translate('xpack.maps.mapSettingsPanel.autoFitToBoundsLocationLabel', { + defaultMessage: 'Auto fit map to data bounds', + }), + }, { id: INITIAL_LOCATION.FIXED_LOCATION, label: i18n.translate('xpack.maps.mapSettingsPanel.fixedLocationLabel', { @@ -125,7 +131,10 @@ export function NavigationPanel({ center, settings, updateMapSetting, zoom }: Pr }; function renderInitialLocationInputs() { - if (settings.initialLocation === INITIAL_LOCATION.LAST_SAVED_LOCATION) { + if ( + settings.initialLocation === INITIAL_LOCATION.LAST_SAVED_LOCATION || + settings.initialLocation === INITIAL_LOCATION.AUTO_FIT_TO_BOUNDS + ) { return null; } diff --git a/x-pack/plugins/maps/public/routing/routes/maps_app/index.js b/x-pack/plugins/maps/public/routing/routes/maps_app/index.js index c5f959c54fb66d..a2a4ab87affcd1 100644 --- a/x-pack/plugins/maps/public/routing/routes/maps_app/index.js +++ b/x-pack/plugins/maps/public/routing/routes/maps_app/index.js @@ -14,7 +14,7 @@ import { getRefreshConfig, getTimeFilters, hasDirtyState, - hasUnsavedChanges, + getLayerListConfigOnly, } from '../../../selectors/map_selectors'; import { replaceLayerList, @@ -45,9 +45,7 @@ function mapStateToProps(state = {}) { flyoutDisplay: getFlyoutDisplay(state), refreshConfig: getRefreshConfig(state), filters: getFilters(state), - hasUnsavedChanges: (savedMap, initialLayerListConfig) => { - return hasUnsavedChanges(state, savedMap, initialLayerListConfig); - }, + layerListConfigOnly: getLayerListConfigOnly(state), query: getQuery(state), timeFilters: getTimeFilters(state), }; diff --git a/x-pack/plugins/maps/public/routing/routes/maps_app/maps_app_view.js b/x-pack/plugins/maps/public/routing/routes/maps_app/maps_app_view.js index 97a08f11a6757d..91d00990772f4d 100644 --- a/x-pack/plugins/maps/public/routing/routes/maps_app/maps_app_view.js +++ b/x-pack/plugins/maps/public/routing/routes/maps_app/maps_app_view.js @@ -103,7 +103,15 @@ export class MapsAppView extends React.Component { } _hasUnsavedChanges() { - return this.props.hasUnsavedChanges(this.props.savedMap, this.state.initialLayerListConfig); + const savedLayerList = this.props.savedMap.getLayerList(); + return !savedLayerList + ? !_.isEqual(this.props.layerListConfigOnly, this.state.initialLayerListConfig) + : // savedMap stores layerList as a JSON string using JSON.stringify. + // JSON.stringify removes undefined properties from objects. + // savedMap.getLayerList converts the JSON string back into Javascript array of objects. + // Need to perform the same process for layerListConfigOnly to compare apples to apples + // and avoid undefined properties in layerListConfigOnly triggering unsaved changes. + !_.isEqual(JSON.parse(JSON.stringify(this.props.layerListConfigOnly)), savedLayerList); } _setBreadcrumbs = () => { @@ -356,22 +364,20 @@ export class MapsAppView extends React.Component { ); } - render() { - const { filters, isFullScreen } = this.props; + _addFilter = (newFilters) => { + newFilters.forEach((filter) => { + filter.$state = { store: esFilters.FilterStateStore.APP_STATE }; + }); + this._onFiltersChange([...this.props.filters, ...newFilters]); + }; + render() { return this.state.initialized ? ( -
+
{this._renderTopNav()}

{`screenTitle placeholder`}

- { - newFilters.forEach((filter) => { - filter.$state = { store: esFilters.FilterStateStore.APP_STATE }; - }); - this._onFiltersChange([...filters, ...newFilters]); - }} - /> +
) : null; diff --git a/x-pack/plugins/maps/public/selectors/map_selectors.ts b/x-pack/plugins/maps/public/selectors/map_selectors.ts index e082398a02a9e6..40ffda3f31c265 100644 --- a/x-pack/plugins/maps/public/selectors/map_selectors.ts +++ b/x-pack/plugins/maps/public/selectors/map_selectors.ts @@ -52,7 +52,6 @@ import { ISource } from '../classes/sources/source'; import { ITMSSource } from '../classes/sources/tms_source'; import { IVectorSource } from '../classes/sources/vector_source'; import { ILayer } from '../classes/layers/layer'; -import { ISavedGisMap } from '../routing/bootstrap/services/saved_gis_map'; function createLayerInstance( layerDescriptor: LayerDescriptor, @@ -298,6 +297,10 @@ export const getLayerList = createSelector( } ); +export const getLayerListConfigOnly = createSelector(getLayerListRaw, (layerDescriptorList) => { + return copyPersistentState(layerDescriptorList); +}); + export function getLayerById(layerId: string | null, state: MapStoreState): ILayer | undefined { return getLayerList(state).find((layer) => { return layerId === layer.getId(); @@ -417,22 +420,3 @@ export const areLayersLoaded = createSelector( return true; } ); - -export function hasUnsavedChanges( - state: MapStoreState, - savedMap: ISavedGisMap, - initialLayerListConfig: LayerDescriptor[] -) { - const layerListConfigOnly = copyPersistentState(getLayerListRaw(state)); - - const savedLayerList = savedMap.getLayerList(); - - return !savedLayerList - ? !_.isEqual(layerListConfigOnly, initialLayerListConfig) - : // savedMap stores layerList as a JSON string using JSON.stringify. - // JSON.stringify removes undefined properties from objects. - // savedMap.getLayerList converts the JSON string back into Javascript array of objects. - // Need to perform the same process for layerListConfigOnly to compare apples to apples - // and avoid undefined properties in layerListConfigOnly triggering unsaved changes. - !_.isEqual(JSON.parse(JSON.stringify(layerListConfigOnly)), savedLayerList); -} diff --git a/x-pack/plugins/ml/common/util/job_utils.ts b/x-pack/plugins/ml/common/util/job_utils.ts index bb0e351ebfec83..8e6933ed5924f8 100644 --- a/x-pack/plugins/ml/common/util/job_utils.ts +++ b/x-pack/plugins/ml/common/util/job_utils.ts @@ -4,7 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ -import _ from 'lodash'; +import isEmpty from 'lodash/isEmpty'; +import isEqual from 'lodash/isEqual'; +import each from 'lodash/each'; +import pick from 'lodash/pick'; + import semver from 'semver'; import moment, { Duration } from 'moment'; // @ts-ignore @@ -307,7 +311,7 @@ export function getSafeAggregationName(fieldName: string, index: number): string export function uniqWithIsEqual(arr: T): T { return arr.reduce((dedupedArray, value) => { - if (dedupedArray.filter((compareValue: any) => _.isEqual(compareValue, value)).length === 0) { + if (dedupedArray.filter((compareValue: any) => isEqual(compareValue, value)).length === 0) { dedupedArray.push(value); } return dedupedArray; @@ -328,7 +332,7 @@ export function basicJobValidation( if (job) { // Job details - if (_.isEmpty(job.job_id)) { + if (isEmpty(job.job_id)) { messages.push({ id: 'job_id_empty' }); valid = false; } else if (isJobIdValid(job.job_id) === false) { @@ -350,7 +354,7 @@ export function basicJobValidation( // Analysis Configuration if (job.analysis_config.categorization_filters) { let v = true; - _.each(job.analysis_config.categorization_filters, (d) => { + each(job.analysis_config.categorization_filters, (d) => { try { new RegExp(d); } catch (e) { @@ -382,8 +386,8 @@ export function basicJobValidation( valid = false; } else { let v = true; - _.each(job.analysis_config.detectors, (d) => { - if (_.isEmpty(d.function)) { + each(job.analysis_config.detectors, (d) => { + if (isEmpty(d.function)) { v = false; } }); @@ -400,7 +404,7 @@ export function basicJobValidation( // create an array of objects with a subset of the attributes // where we want to make sure they are not be the same across detectors const compareSubSet = job.analysis_config.detectors.map((d) => - _.pick(d, [ + pick(d, [ 'function', 'field_name', 'by_field_name', diff --git a/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.js b/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.js index 69f7635a660321..c6ca4fb821984f 100644 --- a/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.js +++ b/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.js @@ -9,7 +9,9 @@ * This version supports both fetching the annotations by itself (used in the jobs list) and * getting the annotations via props (used in Anomaly Explorer and Single Series Viewer). */ -import _ from 'lodash'; + +import uniq from 'lodash/uniq'; + import PropTypes from 'prop-types'; import rison from 'rison-node'; import React, { Component, Fragment } from 'react'; @@ -255,18 +257,18 @@ export class AnnotationsTable extends Component { // if the annotation is at the series level // then pass the partitioning field(s) and detector index to the Single Metric Viewer - if (_.has(annotation, 'detector_index')) { + if (annotation.detector_index !== undefined) { mlTimeSeriesExplorer.detectorIndex = annotation.detector_index; } - if (_.has(annotation, 'partition_field_value')) { + if (annotation.partition_field_value !== undefined) { entityCondition[annotation.partition_field_name] = annotation.partition_field_value; } - if (_.has(annotation, 'over_field_value')) { + if (annotation.over_field_value !== undefined) { entityCondition[annotation.over_field_name] = annotation.over_field_value; } - if (_.has(annotation, 'by_field_value')) { + if (annotation.by_field_value !== undefined) { // Note that analyses with by and over fields, will have a top-level by_field_name, // but the by_field_value(s) will be in the nested causes array. entityCondition[annotation.by_field_name] = annotation.by_field_value; @@ -421,7 +423,7 @@ export class AnnotationsTable extends Component { }, ]; - const jobIds = _.uniq(annotations.map((a) => a.job_id)); + const jobIds = uniq(annotations.map((a) => a.job_id)); if (jobIds.length > 1) { columns.unshift({ field: 'job_id', diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table.js b/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table.js index 2a890f75fecd8d..378ee82805173f 100644 --- a/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table.js +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table.js @@ -9,7 +9,7 @@ */ import PropTypes from 'prop-types'; -import _ from 'lodash'; +import get from 'lodash/get'; import React, { Component } from 'react'; @@ -70,7 +70,7 @@ class AnomaliesTable extends Component { } else { const examples = item.entityName === 'mlcategory' - ? _.get(this.props.tableData, ['examplesByJobId', item.jobId, item.entityValue]) + ? get(this.props.tableData, ['examplesByJobId', item.jobId, item.entityValue]) : undefined; let definition = undefined; diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table_columns.js b/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table_columns.js index af7c6c8e289f31..57f3a08713ffe0 100644 --- a/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table_columns.js +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table_columns.js @@ -7,7 +7,7 @@ import { EuiButtonIcon, EuiLink, EuiScreenReaderOnly } from '@elastic/eui'; import React from 'react'; -import _ from 'lodash'; +import get from 'lodash/get'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; @@ -251,7 +251,7 @@ export function getColumns( sortable: false, truncateText: true, render: (item) => { - const examples = _.get(examplesByJobId, [item.jobId, item.entityValue], []); + const examples = get(examplesByJobId, [item.jobId, item.entityValue], []); return ( { - const simplified = _.pick(cause, 'typical', 'actual', 'probability'); + const simplified = pick(cause, 'typical', 'actual', 'probability'); // Get the 'entity field name/value' to display in the cause - // For by and over, use by_field_name/value (over_field_name/value are in the top level fields) // For just an 'over' field - the over_field_name/value appear in both top level and cause. - simplified.entityName = _.has(cause, 'by_field_name') - ? cause.by_field_name - : cause.over_field_name; - simplified.entityValue = _.has(cause, 'by_field_value') - ? cause.by_field_value - : cause.over_field_value; + simplified.entityName = cause.by_field_name ? cause.by_field_name : cause.over_field_name; + simplified.entityValue = cause.by_field_value ? cause.by_field_value : cause.over_field_value; return simplified; }); } @@ -471,7 +468,7 @@ export class AnomalyDetails extends Component { renderDetails() { const detailItems = getDetailsItems(this.props.anomaly, this.props.examples, this.props.filter); - const isInterimResult = _.get(this.props.anomaly, 'source.is_interim', false); + const isInterimResult = get(this.props.anomaly, 'source.is_interim', false); return ( diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/influencers_cell.js b/x-pack/plugins/ml/public/application/components/anomalies_table/influencers_cell.js index 2e42606c048d72..abdb0961351abc 100644 --- a/x-pack/plugins/ml/public/application/components/anomalies_table/influencers_cell.js +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/influencers_cell.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import _ from 'lodash'; +import each from 'lodash/each'; import PropTypes from 'prop-types'; import React, { Component } from 'react'; @@ -148,7 +148,7 @@ export class InfluencersCell extends Component { const influencers = []; recordInfluencers.forEach((influencer) => { - _.each(influencer, (influencerFieldValue, influencerFieldName) => { + each(influencer, (influencerFieldValue, influencerFieldName) => { influencers.push({ influencerFieldName, influencerFieldValue, diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.js b/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.js index f603264896cd32..0e4d736a01e47c 100644 --- a/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.js +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import _ from 'lodash'; +import cloneDeep from 'lodash/cloneDeep'; import moment from 'moment'; import rison from 'rison-node'; import PropTypes from 'prop-types'; @@ -58,7 +58,7 @@ class LinksMenuUI extends Component { // If url_value contains $earliest$ and $latest$ tokens, add in times to the source record. // Create a copy of the record as we are adding properties into it. - const record = _.cloneDeep(anomaly.source); + const record = cloneDeep(anomaly.source); const timestamp = record.timestamp; const configuredUrlValue = customUrl.url_value; const timeRangeInterval = parseInterval(customUrl.time_range); @@ -99,7 +99,7 @@ class LinksMenuUI extends Component { if ( (configuredUrlValue.includes('$mlcategoryterms$') || configuredUrlValue.includes('$mlcategoryregex$')) && - _.has(record, 'mlcategory') + record.mlcategory !== undefined ) { const jobId = record.job_id; @@ -156,15 +156,15 @@ class LinksMenuUI extends Component { // Extract the by, over and partition fields for the record. const entityCondition = {}; - if (_.has(record, 'partition_field_value')) { + if (record.partition_field_value !== undefined) { entityCondition[record.partition_field_name] = record.partition_field_value; } - if (_.has(record, 'over_field_value')) { + if (record.over_field_value !== undefined) { entityCondition[record.over_field_name] = record.over_field_value; } - if (_.has(record, 'by_field_value')) { + if (record.by_field_value !== undefined) { // Note that analyses with by and over fields, will have a top-level by_field_name, // but the by_field_value(s) will be in the nested causes array. // TODO - drilldown from cause in expanded row only? diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_config_builder.js b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_config_builder.js index b5e9daad7d1c15..b75784c95c5209 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_config_builder.js +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_config_builder.js @@ -9,8 +9,6 @@ * the raw data in the Explorer dashboard. */ -import _ from 'lodash'; - import { parseInterval } from '../../../../common/util/parse_interval'; import { getEntityFieldList } from '../../../../common/util/anomaly_utils'; import { buildConfigFromDetector } from '../../util/chart_config_builder'; @@ -30,7 +28,7 @@ export function buildConfig(record) { config.detectorLabel = record.function; if ( - _.has(mlJobService.detectorsByJob, record.job_id) && + mlJobService.detectorsByJob[record.job_id] !== undefined && detectorIndex < mlJobService.detectorsByJob[record.job_id].length ) { config.detectorLabel = diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.js b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.js index 7a18914957ba98..00aca5d43be85f 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.js +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.js @@ -11,8 +11,8 @@ import PropTypes from 'prop-types'; import React from 'react'; +import { i18n } from '@kbn/i18n'; -import _ from 'lodash'; import d3 from 'd3'; import $ from 'jquery'; import moment from 'moment'; @@ -33,8 +33,6 @@ import { mlFieldFormatService } from '../../services/field_format_service'; import { CHART_TYPE } from '../explorer_constants'; -import { i18n } from '@kbn/i18n'; - const CONTENT_WRAPPER_HEIGHT = 215; // If a rare/event-distribution chart has a cardinality of 10 or less, @@ -403,7 +401,7 @@ export class ExplorerChartDistribution extends React.Component { .attr('cy', (d) => lineChartYScale(d[CHART_Y_ATTRIBUTE])) .attr('class', (d) => { let markerClass = 'metric-value'; - if (_.has(d, 'anomalyScore') && Number(d.anomalyScore) >= severity) { + if (d.anomalyScore !== undefined && Number(d.anomalyScore) >= severity) { markerClass += ' anomaly-marker '; markerClass += getSeverityWithLow(d.anomalyScore).id; } @@ -444,7 +442,7 @@ export class ExplorerChartDistribution extends React.Component { const tooltipData = [{ label: formattedDate }]; const seriesKey = config.detectorLabel; - if (_.has(marker, 'entity')) { + if (marker.entity !== undefined) { tooltipData.push({ label: i18n.translate('xpack.ml.explorer.distributionChart.entityLabel', { defaultMessage: 'entity', @@ -457,7 +455,7 @@ export class ExplorerChartDistribution extends React.Component { }); } - if (_.has(marker, 'anomalyScore')) { + if (marker.anomalyScore !== undefined) { const score = parseInt(marker.anomalyScore); const displayScore = score > 0 ? score : '< 1'; tooltipData.push({ @@ -494,7 +492,7 @@ export class ExplorerChartDistribution extends React.Component { valueAccessor: 'typical', }); } - if (typeof marker.byFieldName !== 'undefined' && _.has(marker, 'numberOfCauses')) { + if (typeof marker.byFieldName !== 'undefined' && marker.numberOfCauses !== undefined) { tooltipData.push({ label: i18n.translate( 'xpack.ml.explorer.distributionChart.unusualByFieldValuesLabel', @@ -532,7 +530,7 @@ export class ExplorerChartDistribution extends React.Component { }); } - if (_.has(marker, 'scheduledEvents')) { + if (marker.scheduledEvents !== undefined) { marker.scheduledEvents.forEach((scheduledEvent, i) => { tooltipData.push({ label: i18n.translate( diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.js b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.js index 63775c5ca312e9..4d53e747d48553 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.js +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.js @@ -12,10 +12,10 @@ import PropTypes from 'prop-types'; import React from 'react'; -import _ from 'lodash'; import d3 from 'd3'; import $ from 'jquery'; import moment from 'moment'; +import { i18n } from '@kbn/i18n'; import { formatHumanReadableDateTime } from '../../util/date_utils'; import { formatValue } from '../../formatters/format_value'; @@ -40,8 +40,6 @@ import { getTimeBucketsFromCache } from '../../util/time_buckets'; import { mlEscape } from '../../util/string_utils'; import { mlFieldFormatService } from '../../services/field_format_service'; -import { i18n } from '@kbn/i18n'; - const CONTENT_WRAPPER_HEIGHT = 215; const CONTENT_WRAPPER_CLASS = 'ml-explorer-chart-content-wrapper'; @@ -307,7 +305,7 @@ export class ExplorerChartSingleMetric extends React.Component { .on('mouseout', () => tooltipService.hide()); const isAnomalyVisible = (d) => - _.has(d, 'anomalyScore') && Number(d.anomalyScore) >= severity; + d.anomalyScore !== undefined && Number(d.anomalyScore) >= severity; // Update all dots to new positions. dots @@ -380,7 +378,7 @@ export class ExplorerChartSingleMetric extends React.Component { const tooltipData = [{ label: formattedDate }]; const seriesKey = config.detectorLabel; - if (_.has(marker, 'anomalyScore')) { + if (marker.anomalyScore !== undefined) { const score = parseInt(marker.anomalyScore); const displayScore = score > 0 ? score : '< 1'; tooltipData.push({ @@ -411,7 +409,7 @@ export class ExplorerChartSingleMetric extends React.Component { // Show actual/typical when available except for rare detectors. // Rare detectors always have 1 as actual and the probability as typical. // Exposing those values in the tooltip with actual/typical labels might irritate users. - if (_.has(marker, 'actual') && config.functionDescription !== 'rare') { + if (marker.actual !== undefined && config.functionDescription !== 'rare') { // Display the record actual in preference to the chart value, which may be // different depending on the aggregation interval of the chart. tooltipData.push({ @@ -445,7 +443,7 @@ export class ExplorerChartSingleMetric extends React.Component { }, valueAccessor: 'value', }); - if (_.has(marker, 'byFieldName') && _.has(marker, 'numberOfCauses')) { + if (marker.byFieldName !== undefined && marker.numberOfCauses !== undefined) { tooltipData.push({ label: i18n.translate( 'xpack.ml.explorer.distributionChart.unusualByFieldValuesLabel', @@ -483,7 +481,7 @@ export class ExplorerChartSingleMetric extends React.Component { }); } - if (_.has(marker, 'scheduledEvents')) { + if (marker.scheduledEvents !== undefined) { tooltipData.push({ label: i18n.translate('xpack.ml.explorer.singleMetricChart.scheduledEventsLabel', { defaultMessage: 'Scheduled events', diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.js b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.js index 1b83a4ed305609..712b64af2db80c 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.js +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.js @@ -11,7 +11,12 @@ * and manages the layout of the charts in the containing div. */ -import _ from 'lodash'; +import get from 'lodash/get'; +import each from 'lodash/each'; +import find from 'lodash/find'; +import sortBy from 'lodash/sortBy'; +import map from 'lodash/map'; +import reduce from 'lodash/reduce'; import { buildConfig } from './explorer_chart_config_builder'; import { chartLimits, getChartType } from '../../util/chart_utils'; @@ -113,7 +118,7 @@ export const anomalyDataChange = function ( // If source data can be plotted, use that, otherwise model plot will be available. const useSourceData = isSourceDataChartableForDetector(job, detectorIndex); if (useSourceData === true) { - const datafeedQuery = _.get(config, 'datafeedConfig.query', null); + const datafeedQuery = get(config, 'datafeedConfig.query', null); return mlResultsService .getMetricData( config.datafeedConfig.indices, @@ -131,8 +136,8 @@ export const anomalyDataChange = function ( // Extract the partition, by, over fields on which to filter. const criteriaFields = []; const detector = job.analysis_config.detectors[detectorIndex]; - if (_.has(detector, 'partition_field_name')) { - const partitionEntity = _.find(entityFields, { + if (detector.partition_field_name !== undefined) { + const partitionEntity = find(entityFields, { fieldName: detector.partition_field_name, }); if (partitionEntity !== undefined) { @@ -143,8 +148,8 @@ export const anomalyDataChange = function ( } } - if (_.has(detector, 'over_field_name')) { - const overEntity = _.find(entityFields, { fieldName: detector.over_field_name }); + if (detector.over_field_name !== undefined) { + const overEntity = find(entityFields, { fieldName: detector.over_field_name }); if (overEntity !== undefined) { criteriaFields.push( { fieldName: 'over_field_name', fieldValue: overEntity.fieldName }, @@ -153,8 +158,8 @@ export const anomalyDataChange = function ( } } - if (_.has(detector, 'by_field_name')) { - const byEntity = _.find(entityFields, { fieldName: detector.by_field_name }); + if (detector.by_field_name !== undefined) { + const byEntity = find(entityFields, { fieldName: detector.by_field_name }); if (byEntity !== undefined) { criteriaFields.push( { fieldName: 'by_field_name', fieldValue: byEntity.fieldName }, @@ -236,7 +241,7 @@ export const anomalyDataChange = function ( filterField = config.entityFields.find((f) => f.fieldType === 'partition'); } - const datafeedQuery = _.get(config, 'datafeedConfig.query', null); + const datafeedQuery = get(config, 'datafeedConfig.query', null); return mlResultsService.getEventDistributionData( config.datafeedConfig.indices, splitField, @@ -285,7 +290,7 @@ export const anomalyDataChange = function ( if (eventDistribution.length > 0 && records.length > 0) { const filterField = records[0].by_field_value || records[0].over_field_value; chartData = eventDistribution.filter((d) => d.entity !== filterField); - _.map(metricData, (value, time) => { + map(metricData, (value, time) => { // The filtering for rare/event_distribution charts needs to be handled // differently because of how the source data is structured. // For rare chart values we are only interested wether a value is either `0` or not, @@ -304,7 +309,7 @@ export const anomalyDataChange = function ( } }); } else { - chartData = _.map(metricData, (value, time) => ({ + chartData = map(metricData, (value, time) => ({ date: +time, value: value, })); @@ -314,7 +319,7 @@ export const anomalyDataChange = function ( // Iterate through the anomaly records, adding anomalyScore properties // to the chartData entries for anomalous buckets. const chartDataForPointSearch = getChartDataForPointSearch(chartData, records[0], chartType); - _.each(records, (record) => { + each(records, (record) => { // Look for a chart point with the same time as the record. // If none found, insert a point for anomalies due to a gap in the data. const recordTime = record[ML_TIME_FIELD_NAME]; @@ -330,13 +335,13 @@ export const anomalyDataChange = function ( chartPoint.actual = record.actual; chartPoint.typical = record.typical; } else { - const causes = _.get(record, 'causes', []); + const causes = get(record, 'causes', []); if (causes.length > 0) { chartPoint.byFieldName = record.by_field_name; chartPoint.numberOfCauses = causes.length; if (causes.length === 1) { // If only a single cause, copy actual and typical values to the top level. - const cause = _.first(record.causes); + const cause = record.causes[0]; chartPoint.actual = cause.actual; chartPoint.typical = cause.typical; } @@ -351,7 +356,7 @@ export const anomalyDataChange = function ( // Add a scheduledEvents property to any points in the chart data set // which correspond to times of scheduled events for the job. if (scheduledEvents !== undefined) { - _.each(scheduledEvents, (events, time) => { + each(scheduledEvents, (events, time) => { const chartPoint = findChartPointForTime(chartDataForPointSearch, Number(time)); if (chartPoint !== undefined) { // Note if the scheduled event coincides with an absence of the underlying metric data, @@ -385,10 +390,10 @@ export const anomalyDataChange = function ( .then((response) => { // calculate an overall min/max for all series const processedData = response.map(processChartData); - const allDataPoints = _.reduce( + const allDataPoints = reduce( processedData, (datapoints, series) => { - _.each(series, (d) => datapoints.push(d)); + each(series, (d) => datapoints.push(d)); return datapoints; }, [] @@ -420,7 +425,7 @@ function processRecordsForDisplay(anomalyRecords) { // Aggregate by job, detector, and analysis fields (partition, by, over). const aggregatedData = {}; - _.each(anomalyRecords, (record) => { + each(anomalyRecords, (record) => { // Check if we can plot a chart for this record, depending on whether the source data // is chartable, and if model plot is enabled for the job. const job = mlJobService.getJob(record.job_id); @@ -524,20 +529,20 @@ function processRecordsForDisplay(anomalyRecords) { let recordsForSeries = []; // Convert to an array of the records with the highest record_score per unique series. - _.each(aggregatedData, (detectorsForJob) => { - _.each(detectorsForJob, (groupsForDetector) => { + each(aggregatedData, (detectorsForJob) => { + each(detectorsForJob, (groupsForDetector) => { if (groupsForDetector.maxScoreRecord !== undefined) { // Detector with no partition / by field. recordsForSeries.push(groupsForDetector.maxScoreRecord); } else { - _.each(groupsForDetector, (valuesForGroup) => { - _.each(valuesForGroup, (dataForGroupValue) => { + each(groupsForDetector, (valuesForGroup) => { + each(valuesForGroup, (dataForGroupValue) => { if (dataForGroupValue.maxScoreRecord !== undefined) { recordsForSeries.push(dataForGroupValue.maxScoreRecord); } else { // Second level of aggregation for partition and by/over. - _.each(dataForGroupValue, (splitsForGroup) => { - _.each(splitsForGroup, (dataForSplitValue) => { + each(dataForGroupValue, (splitsForGroup) => { + each(splitsForGroup, (dataForSplitValue) => { recordsForSeries.push(dataForSplitValue.maxScoreRecord); }); }); @@ -547,7 +552,7 @@ function processRecordsForDisplay(anomalyRecords) { } }); }); - recordsForSeries = _.sortBy(recordsForSeries, 'record_score').reverse(); + recordsForSeries = sortBy(recordsForSeries, 'record_score').reverse(); return recordsForSeries; } @@ -564,7 +569,7 @@ function calculateChartRange( // Calculate the time range for the charts. // Fit in as many points in the available container width plotted at the job bucket span. const midpointMs = Math.ceil((earliestMs + latestMs) / 2); - const maxBucketSpanMs = Math.max.apply(null, _.map(seriesConfigs, 'bucketSpanSeconds')) * 1000; + const maxBucketSpanMs = Math.max.apply(null, map(seriesConfigs, 'bucketSpanSeconds')) * 1000; const pointsToPlotFullSelection = Math.ceil((latestMs - earliestMs) / maxBucketSpanMs); @@ -588,7 +593,7 @@ function calculateChartRange( let minMs = recordsToPlot[0][timeFieldName]; let maxMs = recordsToPlot[0][timeFieldName]; - _.each(recordsToPlot, (record) => { + each(recordsToPlot, (record) => { const diffMs = maxMs - minMs; if (diffMs < maxTimeSpan) { const recordTime = record[timeFieldName]; diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.test.js b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.test.js index 433aa65cc5dd41..a7d422d1611080 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.test.js +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import _ from 'lodash'; +import cloneDeep from 'lodash/cloneDeep'; import mockAnomalyChartRecords from './__mocks__/mock_anomaly_chart_records.json'; import mockDetectorsByJob from './__mocks__/mock_detectors_by_job.json'; @@ -24,10 +24,10 @@ import mockSeriesPromisesResponse from './__mocks__/mock_series_promises_respons // suitable responses from the mocked services. The mocked services check against the // provided alternative values and return specific modified mock responses for the test case. -const mockJobConfigClone = _.cloneDeep(mockJobConfig); +const mockJobConfigClone = cloneDeep(mockJobConfig); // adjust mock data to tests against null/0 values -const mockMetricClone = _.cloneDeep(mockSeriesPromisesResponse[0][0]); +const mockMetricClone = cloneDeep(mockSeriesPromisesResponse[0][0]); mockMetricClone.results['1486712700000'] = null; mockMetricClone.results['1486713600000'] = 0; @@ -127,7 +127,7 @@ describe('explorerChartsContainerService', () => { }); test('filtering should skip values of null', (done) => { - const mockAnomalyChartRecordsClone = _.cloneDeep(mockAnomalyChartRecords).map((d) => { + const mockAnomalyChartRecordsClone = cloneDeep(mockAnomalyChartRecords).map((d) => { d.job_id = 'mock-job-id-distribution'; return d; }); @@ -151,7 +151,7 @@ describe('explorerChartsContainerService', () => { }); test('field value with trailing dot should not throw an error', (done) => { - const mockAnomalyChartRecordsClone = _.cloneDeep(mockAnomalyChartRecords); + const mockAnomalyChartRecordsClone = cloneDeep(mockAnomalyChartRecords); mockAnomalyChartRecordsClone[1].partition_field_value = 'AAL.'; expect(() => { diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_swimlane.tsx b/x-pack/plugins/ml/public/application/explorer/explorer_swimlane.tsx index 2590ab2f1cb230..05e082711f6197 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_swimlane.tsx +++ b/x-pack/plugins/ml/public/application/explorer/explorer_swimlane.tsx @@ -10,7 +10,9 @@ import React from 'react'; import './_explorer.scss'; -import _, { isEqual } from 'lodash'; +import isEqual from 'lodash/isEqual'; +import uniq from 'lodash/uniq'; +import get from 'lodash/get'; import d3 from 'd3'; import moment from 'moment'; import DragSelect from 'dragselect'; @@ -176,9 +178,9 @@ export class ExplorerSwimlane extends React.Component { } ); - selectedData.laneLabels = _.uniq(selectedData.laneLabels); - selectedData.times = _.uniq(selectedData.times); - if (_.isEqual(selectedData, previousSelectedData) === false) { + selectedData.laneLabels = uniq(selectedData.laneLabels); + selectedData.times = uniq(selectedData.times); + if (isEqual(selectedData, previousSelectedData) === false) { // If no cells containing anomalies have been selected, // immediately clear the selection, otherwise trigger // a reload with the updated selected cells. @@ -246,7 +248,7 @@ export class ExplorerSwimlane extends React.Component { selectedTimes: d3.extent(times), }; - if (_.isEqual(oldSelection, newSelection)) { + if (isEqual(oldSelection, newSelection)) { triggerNewSelection = false; } @@ -277,8 +279,8 @@ export class ExplorerSwimlane extends React.Component { // Check for selection and reselect the corresponding swimlane cell // if the time range and lane label are still in view. const selectionState = selection; - const selectedType = _.get(selectionState, 'type', undefined); - const selectionViewByFieldName = _.get(selectionState, 'viewByFieldName', ''); + const selectedType = get(selectionState, 'type', undefined); + const selectionViewByFieldName = get(selectionState, 'viewByFieldName', ''); // If a selection was done in the other swimlane, add the "masked" classes // to de-emphasize the swimlane cells. @@ -288,8 +290,8 @@ export class ExplorerSwimlane extends React.Component { } const cellsToSelect: Node[] = []; - const selectedLanes = _.get(selectionState, 'lanes', []); - const selectedTimes = _.get(selectionState, 'times', []); + const selectedLanes = get(selectionState, 'lanes', []); + const selectedTimes = get(selectionState, 'times', []); const selectedTimeExtent = d3.extent(selectedTimes); if ( diff --git a/x-pack/plugins/ml/public/application/services/forecast_service.js b/x-pack/plugins/ml/public/application/services/forecast_service.js index ed5a29ff74a630..57e50387a03ab5 100644 --- a/x-pack/plugins/ml/public/application/services/forecast_service.js +++ b/x-pack/plugins/ml/public/application/services/forecast_service.js @@ -6,7 +6,9 @@ // Service for carrying out requests to run ML forecasts and to obtain // data on forecasts that have been performed. -import _ from 'lodash'; +import get from 'lodash/get'; +import find from 'lodash/find'; +import each from 'lodash/each'; import { map } from 'rxjs/operators'; import { ml } from './ml_api_service'; @@ -129,8 +131,8 @@ function getForecastDateRange(job, forecastId) { }, }) .then((resp) => { - obj.earliest = _.get(resp, 'aggregations.earliest.value', null); - obj.latest = _.get(resp, 'aggregations.latest.value', null); + obj.earliest = get(resp, 'aggregations.earliest.value', null); + obj.latest = get(resp, 'aggregations.latest.value', null); if (obj.earliest === null || obj.latest === null) { reject(resp); } else { @@ -157,8 +159,8 @@ function getForecastData( // Extract the partition, by, over fields on which to filter. const criteriaFields = []; const detector = job.analysis_config.detectors[detectorIndex]; - if (_.has(detector, 'partition_field_name')) { - const partitionEntity = _.find(entityFields, { fieldName: detector.partition_field_name }); + if (detector.partition_field_name !== undefined) { + const partitionEntity = find(entityFields, { fieldName: detector.partition_field_name }); if (partitionEntity !== undefined) { criteriaFields.push( { fieldName: 'partition_field_name', fieldValue: partitionEntity.fieldName }, @@ -167,8 +169,8 @@ function getForecastData( } } - if (_.has(detector, 'over_field_name')) { - const overEntity = _.find(entityFields, { fieldName: detector.over_field_name }); + if (detector.over_field_name !== undefined) { + const overEntity = find(entityFields, { fieldName: detector.over_field_name }); if (overEntity !== undefined) { criteriaFields.push( { fieldName: 'over_field_name', fieldValue: overEntity.fieldName }, @@ -177,8 +179,8 @@ function getForecastData( } } - if (_.has(detector, 'by_field_name')) { - const byEntity = _.find(entityFields, { fieldName: detector.by_field_name }); + if (detector.by_field_name !== undefined) { + const byEntity = find(entityFields, { fieldName: detector.by_field_name }); if (byEntity !== undefined) { criteriaFields.push( { fieldName: 'by_field_name', fieldValue: byEntity.fieldName }, @@ -222,7 +224,7 @@ function getForecastData( ]; // Add in term queries for each of the specified criteria. - _.each(criteriaFields, (criteria) => { + each(criteriaFields, (criteria) => { filterCriteria.push({ term: { [criteria.fieldName]: criteria.fieldValue, @@ -281,13 +283,13 @@ function getForecastData( }) .pipe( map((resp) => { - const aggregationsByTime = _.get(resp, ['aggregations', 'times', 'buckets'], []); - _.each(aggregationsByTime, (dataForTime) => { + const aggregationsByTime = get(resp, ['aggregations', 'times', 'buckets'], []); + each(aggregationsByTime, (dataForTime) => { const time = dataForTime.key; obj.results[time] = { - prediction: _.get(dataForTime, ['prediction', 'value']), - forecastUpper: _.get(dataForTime, ['forecastUpper', 'value']), - forecastLower: _.get(dataForTime, ['forecastLower', 'value']), + prediction: get(dataForTime, ['prediction', 'value']), + forecastUpper: get(dataForTime, ['forecastUpper', 'value']), + forecastLower: get(dataForTime, ['forecastLower', 'value']), }; }); @@ -355,7 +357,7 @@ function getForecastRequestStats(job, forecastId) { }) .then((resp) => { if (resp.hits.total !== 0) { - obj.stats = _.first(resp.hits.hits)._source; + obj.stats = resp.hits.hits[0]._source; } resolve(obj); }) diff --git a/x-pack/plugins/ml/public/application/services/job_service.js b/x-pack/plugins/ml/public/application/services/job_service.js index 7e90758ffd7db0..704d76059f75cc 100644 --- a/x-pack/plugins/ml/public/application/services/job_service.js +++ b/x-pack/plugins/ml/public/application/services/job_service.js @@ -4,7 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ -import _ from 'lodash'; +import cloneDeep from 'lodash/cloneDeep'; +import each from 'lodash/each'; +import find from 'lodash/find'; +import get from 'lodash/get'; +import isNumber from 'lodash/isNumber'; import moment from 'moment'; import { i18n } from '@kbn/i18n'; @@ -135,10 +139,10 @@ class JobService { const jobStats = statsResp.jobs[j]; if (job.job_id === jobStats.job_id) { job.state = jobStats.state; - job.data_counts = _.cloneDeep(jobStats.data_counts); - job.model_size_stats = _.cloneDeep(jobStats.model_size_stats); + job.data_counts = cloneDeep(jobStats.data_counts); + job.model_size_stats = cloneDeep(jobStats.model_size_stats); if (jobStats.node) { - job.node = _.cloneDeep(jobStats.node); + job.node = cloneDeep(jobStats.node); } if (jobStats.open_time) { job.open_time = jobStats.open_time; @@ -212,10 +216,10 @@ class JobService { newJob.state = statsJob.state; newJob.data_counts = {}; newJob.model_size_stats = {}; - newJob.data_counts = _.cloneDeep(statsJob.data_counts); - newJob.model_size_stats = _.cloneDeep(statsJob.model_size_stats); + newJob.data_counts = cloneDeep(statsJob.data_counts); + newJob.model_size_stats = cloneDeep(statsJob.model_size_stats); if (newJob.node) { - newJob.node = _.cloneDeep(statsJob.node); + newJob.node = cloneDeep(statsJob.node); } if (statsJob.open_time) { @@ -352,7 +356,7 @@ class JobService { // create a deep copy of a job object // also remove items from the job which are set by the server and not needed // in the future this formatting could be optional - const tempJob = _.cloneDeep(job); + const tempJob = cloneDeep(job); // remove all of the items which should not be copied // such as counts, state and times @@ -375,7 +379,7 @@ class JobService { delete tempJob.analysis_config.use_per_partition_normalization; - _.each(tempJob.analysis_config.detectors, (d) => { + each(tempJob.analysis_config.detectors, (d) => { delete d.detector_index; }); @@ -469,7 +473,7 @@ class JobService { // find a job based on the id getJob(jobId) { - const job = _.find(jobs, (j) => { + const job = find(jobs, (j) => { return j.job_id === jobId; }); @@ -550,7 +554,7 @@ class JobService { // get fields from detectors if (job.analysis_config.detectors) { - _.each(job.analysis_config.detectors, (dtr) => { + each(job.analysis_config.detectors, (dtr) => { if (dtr.by_field_name) { fields[dtr.by_field_name] = {}; } @@ -568,7 +572,7 @@ class JobService { // get fields from influencers if (job.analysis_config.influencers) { - _.each(job.analysis_config.influencers, (inf) => { + each(job.analysis_config.influencers, (inf) => { fields[inf] = {}; }); } @@ -659,7 +663,7 @@ class JobService { return new Promise((resolve, reject) => { // if the end timestamp is a number, add one ms to it to make it // inclusive of the end of the data - if (_.isNumber(end)) { + if (isNumber(end)) { end++; } @@ -780,7 +784,7 @@ class JobService { }); } }); - _.each(tempGroups, (js, id) => { + each(tempGroups, (js, id) => { groups.push({ id, jobs: js }); }); return groups; @@ -837,9 +841,9 @@ function processBasicJobInfo(localJobService, jobsList) { const customUrlsByJob = {}; // use cloned copy of jobs list so not to alter the original - const jobsListCopy = _.cloneDeep(jobsList); + const jobsListCopy = cloneDeep(jobsList); - _.each(jobsListCopy, (jobObj) => { + each(jobsListCopy, (jobObj) => { const analysisConfig = jobObj.analysis_config; const bucketSpan = parseInterval(analysisConfig.bucket_span); @@ -848,20 +852,20 @@ function processBasicJobInfo(localJobService, jobsList) { bucketSpanSeconds: bucketSpan.asSeconds(), }; - if (_.has(jobObj, 'description') && /^\s*$/.test(jobObj.description) === false) { + if (jobObj.description !== undefined && /^\s*$/.test(jobObj.description) === false) { job.description = jobObj.description; } else { // Just use the id as the description. job.description = jobObj.job_id; } - job.detectors = _.get(analysisConfig, 'detectors', []); + job.detectors = get(analysisConfig, 'detectors', []); detectorsByJob[job.id] = job.detectors; - if (_.has(jobObj, 'custom_settings.custom_urls')) { + if (jobObj.custom_settings !== undefined && jobObj.custom_settings.custom_urls !== undefined) { job.customUrls = []; - _.each(jobObj.custom_settings.custom_urls, (url) => { - if (_.has(url, 'url_name') && _.has(url, 'url_value') && isWebUrl(url.url_value)) { + each(jobObj.custom_settings.custom_urls, (url) => { + if (url.url_name !== undefined && url.url_value !== undefined && isWebUrl(url.url_value)) { // Only make web URLs (i.e. http or https) available in dashboard drilldowns. job.customUrls.push(url); } @@ -897,7 +901,7 @@ function createJobStats(jobsList, jobStats) { const mlNodes = {}; let failedJobs = 0; - _.each(jobsList, (job) => { + each(jobsList, (job) => { if (job.state === 'opened') { jobStats.open.value++; } else if (job.state === 'closed') { diff --git a/x-pack/plugins/ml/public/application/services/mapping_service.js b/x-pack/plugins/ml/public/application/services/mapping_service.js index 52aa5ed7413cb1..251bb0bce56907 100644 --- a/x-pack/plugins/ml/public/application/services/mapping_service.js +++ b/x-pack/plugins/ml/public/application/services/mapping_service.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import _ from 'lodash'; +import each from 'lodash/each'; import { ml } from './ml_api_service'; @@ -16,8 +16,8 @@ export function getFieldTypeFromMapping(index, fieldName) { ml.getFieldCaps({ index, fields: [fieldName] }) .then((resp) => { let fieldType = ''; - _.each(resp.fields, (field) => { - _.each(field, (type) => { + each(resp.fields, (field) => { + each(field, (type) => { if (fieldType === '') { fieldType = type.type; } diff --git a/x-pack/plugins/ml/public/application/services/results_service/result_service_rx.ts b/x-pack/plugins/ml/public/application/services/results_service/result_service_rx.ts index d7f016b4193777..898ca8894cbdab 100644 --- a/x-pack/plugins/ml/public/application/services/results_service/result_service_rx.ts +++ b/x-pack/plugins/ml/public/application/services/results_service/result_service_rx.ts @@ -13,7 +13,8 @@ // Returned response contains a results property containing the requested aggregation. import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; -import _ from 'lodash'; +import each from 'lodash/each'; +import get from 'lodash/get'; import { Dictionary } from '../../../../common/types/common'; import { ML_MEDIAN_PERCENTS } from '../../../../common/util/job_utils'; import { JobId } from '../../../../common/types/anomaly_detection_jobs'; @@ -237,7 +238,7 @@ export function resultsServiceRxProvider(mlApiServices: MlApiServices) { ]; // Add in term queries for each of the specified criteria. - _.each(criteriaFields, (criteria) => { + each(criteriaFields, (criteria) => { mustCriteria.push({ term: { [criteria.fieldName]: criteria.fieldValue, @@ -316,12 +317,12 @@ export function resultsServiceRxProvider(mlApiServices: MlApiServices) { }) .pipe( map((resp) => { - const aggregationsByTime = _.get(resp, ['aggregations', 'times', 'buckets'], []); - _.each(aggregationsByTime, (dataForTime: any) => { + const aggregationsByTime = get(resp, ['aggregations', 'times', 'buckets'], []); + each(aggregationsByTime, (dataForTime: any) => { const time = dataForTime.key; - const modelUpper: number | undefined = _.get(dataForTime, ['modelUpper', 'value']); - const modelLower: number | undefined = _.get(dataForTime, ['modelLower', 'value']); - const actual = _.get(dataForTime, ['actual', 'value']); + const modelUpper: number | undefined = get(dataForTime, ['modelUpper', 'value']); + const modelLower: number | undefined = get(dataForTime, ['modelLower', 'value']); + const actual = get(dataForTime, ['actual', 'value']); obj.results[time] = { actual, @@ -375,7 +376,7 @@ export function resultsServiceRxProvider(mlApiServices: MlApiServices) { if (jobIds && jobIds.length > 0 && !(jobIds.length === 1 && jobIds[0] === '*')) { let jobIdFilterStr = ''; - _.each(jobIds, (jobId, i) => { + each(jobIds, (jobId, i) => { if (i > 0) { jobIdFilterStr += ' OR '; } @@ -391,7 +392,7 @@ export function resultsServiceRxProvider(mlApiServices: MlApiServices) { } // Add in term queries for each of the specified criteria. - _.each(criteriaFields, (criteria) => { + each(criteriaFields, (criteria) => { boolCriteria.push({ term: { [criteria.fieldName]: criteria.fieldValue, @@ -428,7 +429,7 @@ export function resultsServiceRxProvider(mlApiServices: MlApiServices) { .pipe( map((resp) => { if (resp.hits.total !== 0) { - _.each(resp.hits.hits, (hit: any) => { + each(resp.hits.hits, (hit: any) => { obj.records.push(hit._source); }); } @@ -473,7 +474,7 @@ export function resultsServiceRxProvider(mlApiServices: MlApiServices) { if (jobIds && jobIds.length > 0 && !(jobIds.length === 1 && jobIds[0] === '*')) { let jobIdFilterStr = ''; - _.each(jobIds, (jobId, i) => { + each(jobIds, (jobId, i) => { jobIdFilterStr += `${i > 0 ? ' OR ' : ''}job_id:${jobId}`; }); boolCriteria.push({ @@ -536,15 +537,15 @@ export function resultsServiceRxProvider(mlApiServices: MlApiServices) { }) .pipe( map((resp) => { - const dataByJobId = _.get(resp, ['aggregations', 'jobs', 'buckets'], []); - _.each(dataByJobId, (dataForJob: any) => { + const dataByJobId = get(resp, ['aggregations', 'jobs', 'buckets'], []); + each(dataByJobId, (dataForJob: any) => { const jobId: string = dataForJob.key; const resultsForTime: Record = {}; - const dataByTime = _.get(dataForJob, ['times', 'buckets'], []); - _.each(dataByTime, (dataForTime: any) => { + const dataByTime = get(dataForJob, ['times', 'buckets'], []); + each(dataByTime, (dataForTime: any) => { const time: string = dataForTime.key; - const events: object[] = _.get(dataForTime, ['events', 'buckets']); - resultsForTime[time] = _.map(events, 'key'); + const events: any[] = get(dataForTime, ['events', 'buckets']); + resultsForTime[time] = events.map((e) => e.key); }); obj.events[jobId] = resultsForTime; }); diff --git a/x-pack/plugins/ml/public/application/services/results_service/results_service.js b/x-pack/plugins/ml/public/application/services/results_service/results_service.js index 50e2d0a5a2a0ba..0c3b2e40c8e261 100644 --- a/x-pack/plugins/ml/public/application/services/results_service/results_service.js +++ b/x-pack/plugins/ml/public/application/services/results_service/results_service.js @@ -4,7 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import _ from 'lodash'; +import each from 'lodash/each'; +import get from 'lodash/get'; import { ML_MEDIAN_PERCENTS } from '../../../../common/util/job_utils'; import { escapeForElasticsearchQuery } from '../../util/string_utils'; @@ -50,7 +51,7 @@ export function resultsServiceProvider(mlApiServices) { if (jobIds && jobIds.length > 0 && !(jobIds.length === 1 && jobIds[0] === '*')) { let jobIdFilterStr = ''; - _.each(jobIds, (jobId, i) => { + each(jobIds, (jobId, i) => { if (i > 0) { jobIdFilterStr += ' OR '; } @@ -131,18 +132,18 @@ export function resultsServiceProvider(mlApiServices) { }, }) .then((resp) => { - const dataByJobId = _.get(resp, ['aggregations', 'jobId', 'buckets'], []); - _.each(dataByJobId, (dataForJob) => { + const dataByJobId = get(resp, ['aggregations', 'jobId', 'buckets'], []); + each(dataByJobId, (dataForJob) => { const jobId = dataForJob.key; const resultsForTime = {}; - const dataByTime = _.get(dataForJob, ['byTime', 'buckets'], []); - _.each(dataByTime, (dataForTime) => { - const value = _.get(dataForTime, ['anomalyScore', 'value']); + const dataByTime = get(dataForJob, ['byTime', 'buckets'], []); + each(dataByTime, (dataForTime) => { + const value = get(dataForTime, ['anomalyScore', 'value']); if (value !== undefined) { const time = dataForTime.key; - resultsForTime[time] = _.get(dataForTime, ['anomalyScore', 'value']); + resultsForTime[time] = get(dataForTime, ['anomalyScore', 'value']); } }); obj.results[jobId] = resultsForTime; @@ -198,7 +199,7 @@ export function resultsServiceProvider(mlApiServices) { if (jobIds && jobIds.length > 0 && !(jobIds.length === 1 && jobIds[0] === '*')) { let jobIdFilterStr = ''; - _.each(jobIds, (jobId, i) => { + each(jobIds, (jobId, i) => { if (i > 0) { jobIdFilterStr += ' OR '; } @@ -305,17 +306,17 @@ export function resultsServiceProvider(mlApiServices) { }, }) .then((resp) => { - const fieldNameBuckets = _.get( + const fieldNameBuckets = get( resp, ['aggregations', 'influencerFieldNames', 'buckets'], [] ); - _.each(fieldNameBuckets, (nameBucket) => { + each(fieldNameBuckets, (nameBucket) => { const fieldName = nameBucket.key; const fieldValues = []; - const fieldValueBuckets = _.get(nameBucket, ['influencerFieldValues', 'buckets'], []); - _.each(fieldValueBuckets, (valueBucket) => { + const fieldValueBuckets = get(nameBucket, ['influencerFieldValues', 'buckets'], []); + each(fieldValueBuckets, (valueBucket) => { const fieldValueResult = { influencerFieldValue: valueBucket.key, maxAnomalyScore: valueBucket.maxAnomalyScore.value, @@ -360,7 +361,7 @@ export function resultsServiceProvider(mlApiServices) { if (jobIds && jobIds.length > 0 && !(jobIds.length === 1 && jobIds[0] === '*')) { let jobIdFilterStr = ''; - _.each(jobIds, (jobId, i) => { + each(jobIds, (jobId, i) => { if (i > 0) { jobIdFilterStr += ' OR '; } @@ -424,8 +425,8 @@ export function resultsServiceProvider(mlApiServices) { }, }) .then((resp) => { - const buckets = _.get(resp, ['aggregations', 'influencerFieldValues', 'buckets'], []); - _.each(buckets, (bucket) => { + const buckets = get(resp, ['aggregations', 'influencerFieldValues', 'buckets'], []); + each(buckets, (bucket) => { const result = { influencerFieldValue: bucket.key, maxAnomalyScore: bucket.maxAnomalyScore.value, @@ -458,9 +459,9 @@ export function resultsServiceProvider(mlApiServices) { end: latestMs, }) .then((resp) => { - const dataByTime = _.get(resp, ['overall_buckets'], []); - _.each(dataByTime, (dataForTime) => { - const value = _.get(dataForTime, ['overall_score']); + const dataByTime = get(resp, ['overall_buckets'], []); + each(dataByTime, (dataForTime) => { + const value = get(dataForTime, ['overall_score']); if (value !== undefined) { obj.results[dataForTime.timestamp] = value; } @@ -517,7 +518,7 @@ export function resultsServiceProvider(mlApiServices) { if (jobIds && jobIds.length > 0 && !(jobIds.length === 1 && jobIds[0] === '*')) { let jobIdFilterStr = ''; - _.each(jobIds, (jobId, i) => { + each(jobIds, (jobId, i) => { if (i > 0) { jobIdFilterStr += ' OR '; } @@ -537,7 +538,7 @@ export function resultsServiceProvider(mlApiServices) { if (influencerFieldValues && influencerFieldValues.length > 0) { let influencerFilterStr = ''; - _.each(influencerFieldValues, (value, i) => { + each(influencerFieldValues, (value, i) => { if (i > 0) { influencerFilterStr += ' OR '; } @@ -625,17 +626,17 @@ export function resultsServiceProvider(mlApiServices) { }, }) .then((resp) => { - const fieldValueBuckets = _.get( + const fieldValueBuckets = get( resp, ['aggregations', 'influencerFieldValues', 'buckets'], [] ); - _.each(fieldValueBuckets, (valueBucket) => { + each(fieldValueBuckets, (valueBucket) => { const fieldValue = valueBucket.key; const fieldValues = {}; - const timeBuckets = _.get(valueBucket, ['byTime', 'buckets'], []); - _.each(timeBuckets, (timeBucket) => { + const timeBuckets = get(valueBucket, ['byTime', 'buckets'], []); + each(timeBuckets, (timeBucket) => { const time = timeBucket.key; const score = timeBucket.maxAnomalyScore.value; fieldValues[time] = score; @@ -701,7 +702,7 @@ export function resultsServiceProvider(mlApiServices) { if (jobIds && jobIds.length > 0 && !(jobIds.length === 1 && jobIds[0] === '*')) { let jobIdFilterStr = ''; - _.each(jobIds, (jobId, i) => { + each(jobIds, (jobId, i) => { if (i > 0) { jobIdFilterStr += ' OR '; } @@ -744,7 +745,7 @@ export function resultsServiceProvider(mlApiServices) { }) .then((resp) => { if (resp.hits.total !== 0) { - _.each(resp.hits.hits, (hit) => { + each(resp.hits.hits, (hit) => { obj.records.push(hit._source); }); } @@ -797,7 +798,7 @@ export function resultsServiceProvider(mlApiServices) { if (jobIds && jobIds.length > 0 && !(jobIds.length === 1 && jobIds[0] === '*')) { let jobIdFilterStr = ''; - _.each(jobIds, (jobId, i) => { + each(jobIds, (jobId, i) => { if (i > 0) { jobIdFilterStr += ' OR '; } @@ -875,7 +876,7 @@ export function resultsServiceProvider(mlApiServices) { }) .then((resp) => { if (resp.hits.total !== 0) { - _.each(resp.hits.hits, (hit) => { + each(resp.hits.hits, (hit) => { obj.records.push(hit._source); }); } @@ -1000,7 +1001,7 @@ export function resultsServiceProvider(mlApiServices) { }) .then((resp) => { if (resp.hits.total !== 0) { - _.each(resp.hits.hits, (hit) => { + each(resp.hits.hits, (hit) => { obj.records.push(hit._source); }); } @@ -1079,8 +1080,8 @@ export function resultsServiceProvider(mlApiServices) { }, }) .then((resp) => { - const dataByTimeBucket = _.get(resp, ['aggregations', 'eventRate', 'buckets'], []); - _.each(dataByTimeBucket, (dataForTime) => { + const dataByTimeBucket = get(resp, ['aggregations', 'eventRate', 'buckets'], []); + each(dataByTimeBucket, (dataForTime) => { const time = dataForTime.key; obj.results[time] = dataForTime.doc_count; }); @@ -1227,18 +1228,18 @@ export function resultsServiceProvider(mlApiServices) { // Because of the sampling, results of metricFunctions which use sum or count // can be significantly skewed. Taking into account totalHits we calculate a // a factor to normalize results for these metricFunctions. - const totalHits = _.get(resp, ['hits', 'total'], 0); - const successfulShards = _.get(resp, ['_shards', 'successful'], 0); + const totalHits = get(resp, ['hits', 'total'], 0); + const successfulShards = get(resp, ['_shards', 'successful'], 0); let normalizeFactor = 1; if (totalHits > successfulShards * SAMPLER_TOP_TERMS_SHARD_SIZE) { normalizeFactor = totalHits / (successfulShards * SAMPLER_TOP_TERMS_SHARD_SIZE); } - const dataByTime = _.get(resp, ['aggregations', 'sample', 'byTime', 'buckets'], []); + const dataByTime = get(resp, ['aggregations', 'sample', 'byTime', 'buckets'], []); const data = dataByTime.reduce((d, dataForTime) => { const date = +dataForTime.key; - const entities = _.get(dataForTime, ['entities', 'buckets'], []); + const entities = get(dataForTime, ['entities', 'buckets'], []); entities.forEach((entity) => { let value = metricFunction === 'count' ? entity.doc_count : entity.metric.value; @@ -1291,7 +1292,7 @@ export function resultsServiceProvider(mlApiServices) { { term: { job_id: jobId } }, ]; - _.each(criteriaFields, (criteria) => { + each(criteriaFields, (criteria) => { mustCriteria.push({ term: { [criteria.fieldName]: criteria.fieldValue, @@ -1339,11 +1340,11 @@ export function resultsServiceProvider(mlApiServices) { }, }) .then((resp) => { - const aggregationsByTime = _.get(resp, ['aggregations', 'times', 'buckets'], []); - _.each(aggregationsByTime, (dataForTime) => { + const aggregationsByTime = get(resp, ['aggregations', 'times', 'buckets'], []); + each(aggregationsByTime, (dataForTime) => { const time = dataForTime.key; obj.results[time] = { - score: _.get(dataForTime, ['recordScore', 'value']), + score: get(dataForTime, ['recordScore', 'value']), }; }); diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/forecasting_modal.js b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/forecasting_modal.js index 86f12d7ca68c8e..d825844ffa14bc 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/forecasting_modal.js +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/forecasting_modal.js @@ -9,7 +9,7 @@ */ import PropTypes from 'prop-types'; -import _ from 'lodash'; +import get from 'lodash/get'; import React, { Component } from 'react'; @@ -250,8 +250,8 @@ export class ForecastingModalUI extends Component { .getForecastRequestStats(this.props.job, forecastId) .then((resp) => { // Get the progress (stats value is between 0 and 1). - const progress = _.get(resp, ['stats', 'forecast_progress'], previousProgress); - const status = _.get(resp, ['stats', 'forecast_status']); + const progress = get(resp, ['stats', 'forecast_progress'], previousProgress); + const status = get(resp, ['stats', 'forecast_status']); // The requests for forecast stats can get routed to different shards, // and if these operate at different speeds there is a chance that a @@ -263,7 +263,7 @@ export class ForecastingModalUI extends Component { } // Display any messages returned in the request stats. - let messages = _.get(resp, ['stats', 'forecast_messages'], []); + let messages = get(resp, ['stats', 'forecast_messages'], []); messages = messages.map((message) => ({ message, status: MESSAGE_LEVEL.WARNING })); this.setState({ messages }); diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js index 190bce1639c4a5..7ec59f4acbc519 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js @@ -12,9 +12,13 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; import useObservable from 'react-use/lib/useObservable'; -import _ from 'lodash'; +import isEqual from 'lodash/isEqual'; +import reduce from 'lodash/reduce'; +import each from 'lodash/each'; +import get from 'lodash/get'; import d3 from 'd3'; import moment from 'moment'; +import { i18n } from '@kbn/i18n'; import { getSeverityWithLow, @@ -49,8 +53,6 @@ import { unhighlightFocusChartAnnotation, } from './timeseries_chart_annotations'; -import { i18n } from '@kbn/i18n'; - const focusZoomPanelHeight = 25; const focusChartHeight = 310; const focusHeight = focusZoomPanelHeight + focusChartHeight; @@ -399,7 +401,7 @@ class TimeseriesChartIntl extends Component { if (zoomFrom) { focusLoadFrom = zoomFrom.getTime(); } else { - focusLoadFrom = _.reduce( + focusLoadFrom = reduce( combinedData, (memo, point) => Math.min(memo, point.date.getTime()), new Date(2099, 12, 31).getTime() @@ -410,11 +412,7 @@ class TimeseriesChartIntl extends Component { if (zoomTo) { focusLoadTo = zoomTo.getTime(); } else { - focusLoadTo = _.reduce( - combinedData, - (memo, point) => Math.max(memo, point.date.getTime()), - 0 - ); + focusLoadTo = reduce(combinedData, (memo, point) => Math.max(memo, point.date.getTime()), 0); } focusLoadTo = Math.min(focusLoadTo, contextXMax); @@ -431,7 +429,7 @@ class TimeseriesChartIntl extends Component { min: moment(new Date(contextXScaleDomain[0])), max: moment(contextXScaleDomain[1]), }; - if (!_.isEqual(newSelectedBounds, this.selectedBounds)) { + if (!isEqual(newSelectedBounds, this.selectedBounds)) { this.selectedBounds = newSelectedBounds; this.setContextBrushExtent( new Date(contextXScaleDomain[0]), @@ -764,7 +762,7 @@ class TimeseriesChartIntl extends Component { }) .attr('class', (d) => { let markerClass = 'metric-value'; - if (_.has(d, 'anomalyScore')) { + if (d.anomalyScore !== undefined) { markerClass += ` anomaly-marker ${getSeverityWithLow(d.anomalyScore).id}`; } return markerClass; @@ -887,14 +885,14 @@ class TimeseriesChartIntl extends Component { ); const zoomOptions = [{ durationMs: autoZoomDuration, label: 'auto' }]; - _.each(ZOOM_INTERVAL_OPTIONS, (option) => { + each(ZOOM_INTERVAL_OPTIONS, (option) => { if (option.duration.asSeconds() > minSecs && option.duration.asSeconds() < boundsSecs) { zoomOptions.push({ durationMs: option.duration.asMilliseconds(), label: option.label }); } }); xPos += zoomLabel.node().getBBox().width + 4; - _.each(zoomOptions, (option) => { + each(zoomOptions, (option) => { const text = zoomGroup .append('a') .attr('data-ms', option.durationMs) @@ -960,7 +958,7 @@ class TimeseriesChartIntl extends Component { const combinedData = contextForecastData === undefined ? data : data.concat(contextForecastData); const valuesRange = { min: Number.MAX_VALUE, max: Number.MIN_VALUE }; - _.each(combinedData, (item) => { + each(combinedData, (item) => { valuesRange.min = Math.min(item.value, valuesRange.min); valuesRange.max = Math.max(item.value, valuesRange.max); }); @@ -973,7 +971,7 @@ class TimeseriesChartIntl extends Component { (contextForecastData !== undefined && contextForecastData.length > 0) ) { const boundsRange = { min: Number.MAX_VALUE, max: Number.MIN_VALUE }; - _.each(combinedData, (item) => { + each(combinedData, (item) => { boundsRange.min = Math.min(item.lower, boundsRange.min); boundsRange.max = Math.max(item.upper, boundsRange.max); }); @@ -1294,7 +1292,7 @@ class TimeseriesChartIntl extends Component { if (swimlaneData !== undefined && swimlaneData.length > 0) { // Adjust the earliest back to the time of the first swimlane point // if this is before the time filter minimum. - earliest = Math.min(_.first(swimlaneData).date.getTime(), bounds.min.valueOf()); + earliest = Math.min(swimlaneData[0].date.getTime(), bounds.min.valueOf()); } const contextAggMs = contextAggregationInterval.asMilliseconds(); @@ -1352,7 +1350,7 @@ class TimeseriesChartIntl extends Component { const formattedDate = formatHumanReadableDateTimeSeconds(marker.date); const tooltipData = [{ label: formattedDate }]; - if (_.has(marker, 'anomalyScore')) { + if (marker.anomalyScore !== undefined) { const score = parseInt(marker.anomalyScore); const displayScore = score > 0 ? score : '< 1'; tooltipData.push({ @@ -1387,7 +1385,7 @@ class TimeseriesChartIntl extends Component { // Show actual/typical when available except for rare detectors. // Rare detectors always have 1 as actual and the probability as typical. // Exposing those values in the tooltip with actual/typical labels might irritate users. - if (_.has(marker, 'actual') && marker.function !== 'rare') { + if (marker.actual !== undefined && marker.function !== 'rare') { // Display the record actual in preference to the chart value, which may be // different depending on the aggregation interval of the chart. tooltipData.push({ @@ -1421,7 +1419,7 @@ class TimeseriesChartIntl extends Component { }, valueAccessor: 'value', }); - if (_.has(marker, 'byFieldName') && _.has(marker, 'numberOfCauses')) { + if (marker.byFieldName !== undefined && marker.numberOfCauses !== undefined) { const numberOfCauses = marker.numberOfCauses; // If numberOfCauses === 1, won't go into this block as actual/typical copied to top level fields. const byFieldName = mlEscape(marker.byFieldName); @@ -1488,7 +1486,7 @@ class TimeseriesChartIntl extends Component { } } else { // TODO - need better formatting for small decimals. - if (_.get(marker, 'isForecast', false) === true) { + if (get(marker, 'isForecast', false) === true) { tooltipData.push({ label: i18n.translate( 'xpack.ml.timeSeriesExplorer.timeSeriesChart.withoutAnomalyScore.predictionLabel', @@ -1548,7 +1546,7 @@ class TimeseriesChartIntl extends Component { } } - if (_.has(marker, 'scheduledEvents')) { + if (marker.scheduledEvents !== undefined) { marker.scheduledEvents.forEach((scheduledEvent, i) => { tooltipData.push({ label: i18n.translate( @@ -1569,7 +1567,7 @@ class TimeseriesChartIntl extends Component { }); } - if (_.has(marker, 'annotation')) { + if (marker.annotation !== undefined) { tooltipData.length = 0; // header tooltipData.push({ diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseries_search_service.ts b/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseries_search_service.ts index ce5a7565c519b2..d1e959b33e5dcb 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseries_search_service.ts +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseries_search_service.ts @@ -4,7 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import _ from 'lodash'; +import each from 'lodash/each'; +import find from 'lodash/find'; +import get from 'lodash/get'; +import filter from 'lodash/filter'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; @@ -35,8 +38,8 @@ function getMetricData( // Extract the partition, by, over fields on which to filter. const criteriaFields = []; const detector = job.analysis_config.detectors[detectorIndex]; - if (_.has(detector, 'partition_field_name')) { - const partitionEntity: any = _.find(entityFields, { + if (detector.partition_field_name !== undefined) { + const partitionEntity: any = find(entityFields, { fieldName: detector.partition_field_name, }); if (partitionEntity !== undefined) { @@ -47,8 +50,8 @@ function getMetricData( } } - if (_.has(detector, 'over_field_name')) { - const overEntity: any = _.find(entityFields, { fieldName: detector.over_field_name }); + if (detector.over_field_name !== undefined) { + const overEntity: any = find(entityFields, { fieldName: detector.over_field_name }); if (overEntity !== undefined) { criteriaFields.push( { fieldName: 'over_field_name', fieldValue: overEntity.fieldName }, @@ -57,8 +60,8 @@ function getMetricData( } } - if (_.has(detector, 'by_field_name')) { - const byEntity: any = _.find(entityFields, { fieldName: detector.by_field_name }); + if (detector.by_field_name !== undefined) { + const byEntity: any = find(entityFields, { fieldName: detector.by_field_name }); if (byEntity !== undefined) { criteriaFields.push( { fieldName: 'by_field_name', fieldValue: byEntity.fieldName }, @@ -97,7 +100,7 @@ function getMetricData( ) .pipe( map((resp) => { - _.each(resp.results, (value, time) => { + each(resp.results, (value, time) => { // @ts-ignore obj.results[time] = { actual: value, @@ -134,7 +137,7 @@ function getChartDetails( } obj.results.functionLabel = functionLabel; - const blankEntityFields = _.filter(entityFields, (entity) => { + const blankEntityFields = filter(entityFields, (entity) => { return entity.fieldValue === null; }); @@ -145,7 +148,7 @@ function getChartDetails( obj.results.entityData.entities = entityFields; resolve(obj); } else { - const entityFieldNames: string[] = _.map(blankEntityFields, 'fieldName'); + const entityFieldNames: string[] = blankEntityFields.map((f) => f.fieldName); ml.getCardinalityOfFields({ index: chartConfig.datafeedConfig.indices, fieldNames: entityFieldNames, @@ -155,12 +158,12 @@ function getChartDetails( latestMs, }) .then((results: any) => { - _.each(blankEntityFields, (field) => { + each(blankEntityFields, (field) => { // results will not contain keys for non-aggregatable fields, // so store as 0 to indicate over all field values. obj.results.entityData.entities.push({ fieldName: field.fieldName, - cardinality: _.get(results, field.fieldName, 0), + cardinality: get(results, field.fieldName, 0), }); }); diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/timeseriesexplorer_utils.js b/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/timeseriesexplorer_utils.js index 857db302e664eb..7d14bb43ef8117 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/timeseriesexplorer_utils.js +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/timeseriesexplorer_utils.js @@ -10,7 +10,9 @@ * Viewer dashboard. */ -import _ from 'lodash'; +import each from 'lodash/each'; +import get from 'lodash/get'; +import find from 'lodash/find'; import moment from 'moment-timezone'; import { isTimeSeriesViewJob } from '../../../../common/util/job_utils'; @@ -41,7 +43,7 @@ export function createTimeSeriesJobData(jobs) { export function processMetricPlotResults(metricPlotData, modelPlotEnabled) { const metricPlotChartData = []; if (modelPlotEnabled === true) { - _.each(metricPlotData, (dataForTime, time) => { + each(metricPlotData, (dataForTime, time) => { metricPlotChartData.push({ date: new Date(+time), lower: dataForTime.modelLower, @@ -50,7 +52,7 @@ export function processMetricPlotResults(metricPlotData, modelPlotEnabled) { }); }); } else { - _.each(metricPlotData, (dataForTime, time) => { + each(metricPlotData, (dataForTime, time) => { metricPlotChartData.push({ date: new Date(+time), value: dataForTime.actual, @@ -66,7 +68,7 @@ export function processMetricPlotResults(metricPlotData, modelPlotEnabled) { // value, lower and upper keys. export function processForecastResults(forecastData) { const forecastPlotChartData = []; - _.each(forecastData, (dataForTime, time) => { + each(forecastData, (dataForTime, time) => { forecastPlotChartData.push({ date: new Date(+time), isForecast: true, @@ -83,7 +85,7 @@ export function processForecastResults(forecastData) { // i.e. array of Objects with keys date (JavaScript date) and score. export function processRecordScoreResults(scoreData) { const bucketScoreData = []; - _.each(scoreData, (dataForTime, time) => { + each(scoreData, (dataForTime, time) => { bucketScoreData.push({ date: new Date(+time), score: dataForTime.score, @@ -153,7 +155,7 @@ export function processDataForFocusAnomalies( chartPoint.anomalyScore = recordScore; chartPoint.function = record.function; - if (_.has(record, 'actual')) { + if (record.actual !== undefined) { // If cannot match chart point for anomaly time // substitute the value with the record's actual so it won't plot as null/0 if (chartPoint.value === null) { @@ -163,13 +165,13 @@ export function processDataForFocusAnomalies( chartPoint.actual = record.actual; chartPoint.typical = record.typical; } else { - const causes = _.get(record, 'causes', []); + const causes = get(record, 'causes', []); if (causes.length > 0) { chartPoint.byFieldName = record.by_field_name; chartPoint.numberOfCauses = causes.length; if (causes.length === 1) { // If only a single cause, copy actual and typical values to the top level. - const cause = _.first(record.causes); + const cause = record.causes[0]; chartPoint.actual = cause.actual; chartPoint.typical = cause.typical; // substitute the value with the record's actual so it won't plot as null/0 @@ -180,7 +182,7 @@ export function processDataForFocusAnomalies( } } - if (_.has(record, 'multi_bucket_impact')) { + if (record.multi_bucket_impact !== undefined) { chartPoint.multiBucketImpact = record.multi_bucket_impact; } } @@ -194,7 +196,7 @@ export function processDataForFocusAnomalies( // which correspond to times of scheduled events for the job. export function processScheduledEventsForChart(chartData, scheduledEvents) { if (scheduledEvents !== undefined) { - _.each(scheduledEvents, (events, time) => { + each(scheduledEvents, (events, time) => { const chartPoint = findNearestChartPointToTime(chartData, time); if (chartPoint !== undefined) { // Note if the scheduled event coincides with an absence of the underlying metric data, @@ -301,7 +303,7 @@ export function calculateAggregationInterval(bounds, bucketsTarget, jobs, select // Ensure the aggregation interval is always a multiple of the bucket span to avoid strange // behaviour such as adjacent chart buckets holding different numbers of job results. - const bucketSpanSeconds = _.find(jobs, { id: selectedJob.job_id }).bucketSpanSeconds; + const bucketSpanSeconds = find(jobs, { id: selectedJob.job_id }).bucketSpanSeconds; let aggInterval = buckets.getIntervalToNearestMultiple(bucketSpanSeconds); // Set the interval back to the job bucket span if the auto interval is smaller. @@ -324,8 +326,8 @@ export function calculateDefaultFocusRange( const combinedData = isForecastData === false ? contextChartData : contextChartData.concat(contextForecastData); - const earliestDataDate = _.first(combinedData).date; - const latestDataDate = _.last(combinedData).date; + const earliestDataDate = combinedData[0].date; + const latestDataDate = combinedData[combinedData.length - 1].date; let rangeEarliestMs; let rangeLatestMs; @@ -333,8 +335,8 @@ export function calculateDefaultFocusRange( if (isForecastData === true) { // Return a range centred on the start of the forecast range, depending // on the time range of the forecast and data. - const earliestForecastDataDate = _.first(contextForecastData).date; - const latestForecastDataDate = _.last(contextForecastData).date; + const earliestForecastDataDate = contextForecastData[0].date; + const latestForecastDataDate = contextForecastData[contextForecastData.length - 1].date; rangeLatestMs = Math.min( earliestForecastDataDate.getTime() + autoZoomDuration / 2, @@ -379,7 +381,7 @@ export function getAutoZoomDuration(jobs, selectedJob) { // Calculate the 'auto' zoom duration which shows data at bucket span granularity. // Get the minimum bucket span of selected jobs. // TODO - only look at jobs for which data has been returned? - const bucketSpanSeconds = _.find(jobs, { id: selectedJob.job_id }).bucketSpanSeconds; + const bucketSpanSeconds = find(jobs, { id: selectedJob.job_id }).bucketSpanSeconds; // In most cases the duration can be obtained by simply multiplying the points target // Check that this duration returns the bucket span when run back through the diff --git a/x-pack/plugins/ml/public/application/util/chart_config_builder.js b/x-pack/plugins/ml/public/application/util/chart_config_builder.js index 3b09e09d3dd4ae..bc63404a106db0 100644 --- a/x-pack/plugins/ml/public/application/util/chart_config_builder.js +++ b/x-pack/plugins/ml/public/application/util/chart_config_builder.js @@ -9,7 +9,7 @@ * in the source metric data. */ -import _ from 'lodash'; +import get from 'lodash/get'; import { mlFunctionToESAggregation } from '../../../common/util/job_utils'; @@ -44,15 +44,16 @@ export function buildConfigFromDetector(job, detectorIndex) { // aggregations//aggregations//cardinality/field // or aggs//aggs//cardinality/field let cardinalityField = undefined; - const topAgg = _.get(job.datafeed_config, 'aggregations') || _.get(job.datafeed_config, 'aggs'); - if (topAgg !== undefined && _.values(topAgg).length > 0) { + const topAgg = get(job.datafeed_config, 'aggregations') || get(job.datafeed_config, 'aggs'); + if (topAgg !== undefined && Object.values(topAgg).length > 0) { cardinalityField = - _.get(_.values(topAgg)[0], [ + get(Object.values(topAgg)[0], [ 'aggregations', summaryCountFieldName, 'cardinality', 'field', - ]) || _.get(_.values(topAgg)[0], ['aggs', summaryCountFieldName, 'cardinality', 'field']); + ]) || + get(Object.values(topAgg)[0], ['aggs', summaryCountFieldName, 'cardinality', 'field']); } if (detector.function === 'non_zero_count' && cardinalityField !== undefined) { diff --git a/x-pack/plugins/ml/public/application/util/inherits.js b/x-pack/plugins/ml/public/application/util/inherits.js deleted file mode 100644 index bf16e573117d9e..00000000000000 --- a/x-pack/plugins/ml/public/application/util/inherits.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -// create a property descriptor for properties -// that won't change -function describeConst(val) { - return { - writable: false, - enumerable: false, - configurable: false, - value: val, - }; -} - -/** - * Apply inheritance in the legacy `_.class(SubClass).inherits(SuperClass)` - * @param {Function} SubClass class that should inherit SuperClass - * @param {Function} SuperClass - * @return {Function} - */ -export function inherits(SubClass, SuperClass) { - const prototype = Object.create(SuperClass.prototype, { - constructor: describeConst(SubClass), - superConstructor: describeConst(SuperClass), - }); - - Object.defineProperties(SubClass, { - prototype: describeConst(prototype), - Super: describeConst(SuperClass), - }); - - return SubClass; -} diff --git a/x-pack/plugins/ml/public/application/util/time_buckets.js b/x-pack/plugins/ml/public/application/util/time_buckets.js index 19d499faf6c8dd..15b8f24804ec84 100644 --- a/x-pack/plugins/ml/public/application/util/time_buckets.js +++ b/x-pack/plugins/ml/public/application/util/time_buckets.js @@ -4,7 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ -import _ from 'lodash'; +import isPlainObject from 'lodash/isPlainObject'; +import isString from 'lodash/isString'; +import ary from 'lodash/ary'; +import sortBy from 'lodash/sortBy'; +import assign from 'lodash/assign'; import moment from 'moment'; import dateMath from '@elastic/datemath'; @@ -80,16 +84,16 @@ TimeBuckets.prototype.setBounds = function (input) { if (!input) return this.clearBounds(); let bounds; - if (_.isPlainObject(input)) { + if (isPlainObject(input)) { // accept the response from timefilter.getActiveBounds() bounds = [input.min, input.max]; } else { bounds = Array.isArray(input) ? input : []; } - const moments = _(bounds).map(_.ary(moment, 1)).sortBy(Number); + const moments = sortBy(bounds.map(ary(moment, 1)), Number); - const valid = moments.size() === 2 && moments.every(isValidMoment); + const valid = moments.length === 2 && moments.every(isValidMoment); if (!valid) { this.clearBounds(); throw new Error('invalid bounds set: ' + input); @@ -175,7 +179,7 @@ TimeBuckets.prototype.setInterval = function (input) { return; } - if (_.isString(interval)) { + if (isString(interval)) { input = interval; interval = parseInterval(interval); if (+interval === 0) { @@ -256,7 +260,7 @@ TimeBuckets.prototype.getInterval = function () { if (+scaled === +interval) return interval; decorateInterval(interval, duration); - return _.assign(scaled, { + return assign(scaled, { preScaled: interval, scale: interval / scaled, scaled: true, @@ -287,7 +291,7 @@ TimeBuckets.prototype.getIntervalToNearestMultiple = function (divisorSecs) { decorateInterval(nearestMultipleInt, this.getDuration()); // Check to see if the new interval is scaled compared to the original. - const preScaled = _.get(interval, 'preScaled'); + const preScaled = interval.preScaled; if (preScaled !== undefined && preScaled < nearestMultipleInt) { nearestMultipleInt.preScaled = preScaled; nearestMultipleInt.scale = preScaled / nearestMultipleInt; diff --git a/x-pack/plugins/ml/server/lib/telemetry/telemetry.ts b/x-pack/plugins/ml/server/lib/telemetry/telemetry.ts index f2162ff2c3d30a..d9ebccd5547331 100644 --- a/x-pack/plugins/ml/server/lib/telemetry/telemetry.ts +++ b/x-pack/plugins/ml/server/lib/telemetry/telemetry.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import _ from 'lodash'; +import isEmpty from 'lodash/isEmpty'; import { ISavedObjectsRepository } from 'kibana/server'; import { getInternalRepository } from './internal_repository'; @@ -58,7 +58,7 @@ export async function updateTelemetry(internalRepo?: ISavedObjectsRepository) { let telemetry = await getTelemetry(internalRepository); // Create if doesn't exist - if (telemetry === null || _.isEmpty(telemetry)) { + if (telemetry === null || isEmpty(telemetry)) { const newTelemetrySavedObject = await internalRepository.create( TELEMETRY_DOC_ID, initTelemetry(), diff --git a/x-pack/plugins/ml/server/models/annotation_service/annotation.ts b/x-pack/plugins/ml/server/models/annotation_service/annotation.ts index 8094689abf3e5e..a585449db0a255 100644 --- a/x-pack/plugins/ml/server/models/annotation_service/annotation.ts +++ b/x-pack/plugins/ml/server/models/annotation_service/annotation.ts @@ -5,7 +5,8 @@ */ import Boom from 'boom'; -import _ from 'lodash'; +import each from 'lodash/each'; +import get from 'lodash/get'; import { ILegacyScopedClusterClient } from 'kibana/server'; import { ANNOTATION_EVENT_USER, ANNOTATION_TYPE } from '../../../common/constants/annotations'; @@ -190,7 +191,7 @@ export function annotationProvider({ callAsInternalUser }: ILegacyScopedClusterC if (jobIds && jobIds.length > 0 && !(jobIds.length === 1 && jobIds[0] === '*')) { let jobIdFilterStr = ''; - _.each(jobIds, (jobId, i: number) => { + each(jobIds, (jobId, i: number) => { jobIdFilterStr += `${i! > 0 ? ' OR ' : ''}job_id:${jobId}`; }); boolCriteria.push({ @@ -293,7 +294,7 @@ export function annotationProvider({ callAsInternalUser }: ILegacyScopedClusterC throw new Error(`Annotations couldn't be retrieved from Elasticsearch.`); } - const docs: Annotations = _.get(resp, ['hits', 'hits'], []).map((d: EsResult) => { + const docs: Annotations = get(resp, ['hits', 'hits'], []).map((d: EsResult) => { // get the original source document and the document id, we need it // to identify the annotation when editing/deleting it. // if original `event` is undefined then substitute with 'user` by default @@ -305,7 +306,7 @@ export function annotationProvider({ callAsInternalUser }: ILegacyScopedClusterC } as Annotation; }); - const aggregations = _.get(resp, ['aggregations'], {}) as EsAggregationResult; + const aggregations = get(resp, ['aggregations'], {}) as EsAggregationResult; if (fields) { obj.aggregations = aggregations; } diff --git a/x-pack/plugins/ml/server/models/bucket_span_estimator/bucket_span_estimator.js b/x-pack/plugins/ml/server/models/bucket_span_estimator/bucket_span_estimator.js index 37585477794039..381c615051e3b3 100644 --- a/x-pack/plugins/ml/server/models/bucket_span_estimator/bucket_span_estimator.js +++ b/x-pack/plugins/ml/server/models/bucket_span_estimator/bucket_span_estimator.js @@ -4,7 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ -import _ from 'lodash'; +import cloneDeep from 'lodash/cloneDeep'; +import each from 'lodash/each'; +import remove from 'lodash/remove'; +import sortBy from 'lodash/sortBy'; +import get from 'lodash/get'; import { mlLog } from '../../client/log'; @@ -91,7 +95,7 @@ export function estimateBucketSpanFactory(mlClusterClient) { } else { // loop over partition values for (let j = 0; j < this.splitFieldValues.length; j++) { - const queryCopy = _.cloneDeep(this.query); + const queryCopy = cloneDeep(this.query); // add a term to the query to filter on the partition value queryCopy.bool.must.push({ term: { @@ -151,7 +155,7 @@ export function estimateBucketSpanFactory(mlClusterClient) { } }; - _.each(this.checkers, (check) => { + each(this.checkers, (check) => { check.check .run() .then((interval) => { @@ -174,7 +178,7 @@ export function estimateBucketSpanFactory(mlClusterClient) { } processResults() { - const allResults = _.map(this.checkers, 'result'); + const allResults = this.checkers.map((c) => c.result); let reducedResults = []; const numberOfSplitFields = this.splitFieldValues.length || 1; @@ -185,8 +189,8 @@ export function estimateBucketSpanFactory(mlClusterClient) { const pos = i * numberOfSplitFields; let resultsSubset = allResults.slice(pos, pos + numberOfSplitFields); // remove results of tests which have failed - resultsSubset = _.remove(resultsSubset, (res) => res !== null); - resultsSubset = _.sortBy(resultsSubset, (r) => r.ms); + resultsSubset = remove(resultsSubset, (res) => res !== null); + resultsSubset = sortBy(resultsSubset, (r) => r.ms); const tempMedian = this.findMedian(resultsSubset); if (tempMedian !== null) { @@ -194,7 +198,7 @@ export function estimateBucketSpanFactory(mlClusterClient) { } } - reducedResults = _.sortBy(reducedResults, (r) => r.ms); + reducedResults = sortBy(reducedResults, (r) => r.ms); return this.findMedian(reducedResults); } @@ -256,7 +260,7 @@ export function estimateBucketSpanFactory(mlClusterClient) { }, }) .then((resp) => { - const value = _.get(resp, ['aggregations', 'field_count', 'value'], 0); + const value = get(resp, ['aggregations', 'field_count', 'value'], 0); resolve(value); }) .catch((resp) => { @@ -293,9 +297,10 @@ export function estimateBucketSpanFactory(mlClusterClient) { }, }) .then((partitionResp) => { - if (_.has(partitionResp, 'aggregations.fields_bucket_counts.buckets')) { + // eslint-disable-next-line camelcase + if (partitionResp.aggregations?.fields_bucket_counts?.buckets !== undefined) { const buckets = partitionResp.aggregations.fields_bucket_counts.buckets; - fieldValues = _.map(buckets, (b) => b.key); + fieldValues = buckets.map((b) => b.key); } resolve(fieldValues); }) diff --git a/x-pack/plugins/ml/server/models/bucket_span_estimator/polled_data_checker.js b/x-pack/plugins/ml/server/models/bucket_span_estimator/polled_data_checker.js index 347843e276c368..d3bbd59f3cf9bc 100644 --- a/x-pack/plugins/ml/server/models/bucket_span_estimator/polled_data_checker.js +++ b/x-pack/plugins/ml/server/models/bucket_span_estimator/polled_data_checker.js @@ -10,7 +10,7 @@ * And a minimum bucket span */ -import _ from 'lodash'; +import get from 'lodash/get'; export function polledDataCheckerFactory({ callAsCurrentUser }) { class PolledDataChecker { @@ -29,7 +29,7 @@ export function polledDataCheckerFactory({ callAsCurrentUser }) { const interval = { name: '1m', ms: 60000 }; this.performSearch(interval.ms) .then((resp) => { - const fullBuckets = _.get(resp, 'aggregations.non_empty_buckets.buckets', []); + const fullBuckets = get(resp, 'aggregations.non_empty_buckets.buckets', []); const result = this.isPolledData(fullBuckets, interval); if (result.pass) { // data is polled, return a flag and the minimumBucketSpan which should be diff --git a/x-pack/plugins/ml/server/models/data_visualizer/data_visualizer.ts b/x-pack/plugins/ml/server/models/data_visualizer/data_visualizer.ts index 7f19f32373e077..838315d8d272ca 100644 --- a/x-pack/plugins/ml/server/models/data_visualizer/data_visualizer.ts +++ b/x-pack/plugins/ml/server/models/data_visualizer/data_visualizer.ts @@ -5,7 +5,10 @@ */ import { ILegacyScopedClusterClient } from 'kibana/server'; -import _ from 'lodash'; +import get from 'lodash/get'; +import each from 'lodash/each'; +import last from 'lodash/last'; +import find from 'lodash/find'; import { KBN_FIELD_TYPES } from '../../../../../../src/plugins/data/server'; import { ML_JOB_FIELD_TYPES } from '../../../common/constants/field_types'; import { getSafeAggregationName } from '../../../common/util/job_utils'; @@ -216,7 +219,7 @@ const getAggIntervals = async ( const aggsPath = getSamplerAggregationsResponsePath(samplerShardSize); const aggregations = - aggsPath.length > 0 ? _.get(respStats.aggregations, aggsPath) : respStats.aggregations; + aggsPath.length > 0 ? get(respStats.aggregations, aggsPath) : respStats.aggregations; return Object.keys(aggregations).reduce((p, aggName) => { const stats = [aggregations[aggName].min, aggregations[aggName].max]; @@ -300,9 +303,7 @@ export const getHistogramsForFields = async ( const aggsPath = getSamplerAggregationsResponsePath(samplerShardSize); const aggregations = - aggsPath.length > 0 - ? _.get(respChartsData.aggregations, aggsPath) - : respChartsData.aggregations; + aggsPath.length > 0 ? get(respChartsData.aggregations, aggsPath) : respChartsData.aggregations; const chartsData: ChartData[] = fields.map( (field): ChartData => { @@ -382,8 +383,8 @@ export class DataVisualizer { // To avoid checking for the existence of too many aggregatable fields in one request, // split the check into multiple batches (max 200 fields per request). const batches: string[][] = [[]]; - _.each(aggregatableFields, (field) => { - let lastArray: string[] = _.last(batches) as string[]; + each(aggregatableFields, (field) => { + let lastArray: string[] = last(batches) as string[]; if (lastArray.length === AGGREGATABLE_EXISTS_REQUEST_BATCH_SIZE) { lastArray = []; batches.push(lastArray); @@ -475,7 +476,7 @@ export class DataVisualizer { // Batch up fields by type, getting stats for multiple fields at a time. const batches: Field[][] = []; const batchedFields: { [key: string]: Field[][] } = {}; - _.each(fields, (field) => { + each(fields, (field) => { if (field.fieldName === undefined) { // undefined fieldName is used for a document count request. // getDocumentCountStats requires timeField - don't add to batched requests if not defined @@ -487,7 +488,7 @@ export class DataVisualizer { if (batchedFields[fieldType] === undefined) { batchedFields[fieldType] = [[]]; } - let lastArray: Field[] = _.last(batchedFields[fieldType]) as Field[]; + let lastArray: Field[] = last(batchedFields[fieldType]) as Field[]; if (lastArray.length === FIELDS_REQUEST_BATCH_SIZE) { lastArray = []; batchedFields[fieldType].push(lastArray); @@ -496,7 +497,7 @@ export class DataVisualizer { } }); - _.each(batchedFields, (lists) => { + each(batchedFields, (lists) => { batches.push(...lists); }); @@ -636,7 +637,7 @@ export class DataVisualizer { body, }); const aggregations = resp.aggregations; - const totalCount = _.get(resp, ['hits', 'total'], 0); + const totalCount = get(resp, ['hits', 'total'], 0); const stats = { totalCount, aggregatableExistsFields: [] as FieldData[], @@ -645,12 +646,12 @@ export class DataVisualizer { const aggsPath = getSamplerAggregationsResponsePath(samplerShardSize); const sampleCount = - samplerShardSize > 0 ? _.get(aggregations, ['sample', 'doc_count'], 0) : totalCount; + samplerShardSize > 0 ? get(aggregations, ['sample', 'doc_count'], 0) : totalCount; aggregatableFields.forEach((field, i) => { const safeFieldName = getSafeAggregationName(field, i); - const count = _.get(aggregations, [...aggsPath, `${safeFieldName}_count`, 'doc_count'], 0); + const count = get(aggregations, [...aggsPath, `${safeFieldName}_count`, 'doc_count'], 0); if (count > 0) { - const cardinality = _.get( + const cardinality = get( aggregations, [...aggsPath, `${safeFieldName}_cardinality`, 'value'], 0 @@ -745,12 +746,12 @@ export class DataVisualizer { }); const buckets: { [key: string]: number } = {}; - const dataByTimeBucket: Array<{ key: string; doc_count: number }> = _.get( + const dataByTimeBucket: Array<{ key: string; doc_count: number }> = get( resp, ['aggregations', 'eventRate', 'buckets'], [] ); - _.each(dataByTimeBucket, (dataForTime) => { + each(dataByTimeBucket, (dataForTime) => { const time = dataForTime.key; buckets[time] = dataForTime.doc_count; }); @@ -851,12 +852,12 @@ export class DataVisualizer { const batchStats: NumericFieldStats[] = []; fields.forEach((field, i) => { const safeFieldName = getSafeAggregationName(field.fieldName, i); - const docCount = _.get( + const docCount = get( aggregations, [...aggsPath, `${safeFieldName}_field_stats`, 'doc_count'], 0 ); - const fieldStatsResp = _.get( + const fieldStatsResp = get( aggregations, [...aggsPath, `${safeFieldName}_field_stats`, 'actual_stats'], {} @@ -867,20 +868,20 @@ export class DataVisualizer { topAggsPath.push('top'); } - const topValues: Bucket[] = _.get(aggregations, [...topAggsPath, 'buckets'], []); + const topValues: Bucket[] = get(aggregations, [...topAggsPath, 'buckets'], []); const stats: NumericFieldStats = { fieldName: field.fieldName, count: docCount, - min: _.get(fieldStatsResp, 'min', 0), - max: _.get(fieldStatsResp, 'max', 0), - avg: _.get(fieldStatsResp, 'avg', 0), + min: get(fieldStatsResp, 'min', 0), + max: get(fieldStatsResp, 'max', 0), + avg: get(fieldStatsResp, 'avg', 0), isTopValuesSampled: field.cardinality >= SAMPLER_TOP_TERMS_THRESHOLD || samplerShardSize > 0, topValues, topValuesSampleSize: topValues.reduce( (acc, curr) => acc + curr.doc_count, - _.get(aggregations, [...topAggsPath, 'sum_other_doc_count'], 0) + get(aggregations, [...topAggsPath, 'sum_other_doc_count'], 0) ), topValuesSamplerShardSize: field.cardinality >= SAMPLER_TOP_TERMS_THRESHOLD @@ -889,12 +890,12 @@ export class DataVisualizer { }; if (stats.count > 0) { - const percentiles = _.get( + const percentiles = get( aggregations, [...aggsPath, `${safeFieldName}_percentiles`, 'values'], [] ); - const medianPercentile: { value: number; key: number } | undefined = _.find(percentiles, { + const medianPercentile: { value: number; key: number } | undefined = find(percentiles, { key: 50, }); stats.median = medianPercentile !== undefined ? medianPercentile!.value : 0; @@ -978,7 +979,7 @@ export class DataVisualizer { topAggsPath.push('top'); } - const topValues: Bucket[] = _.get(aggregations, [...topAggsPath, 'buckets'], []); + const topValues: Bucket[] = get(aggregations, [...topAggsPath, 'buckets'], []); const stats = { fieldName: field.fieldName, @@ -987,7 +988,7 @@ export class DataVisualizer { topValues, topValuesSampleSize: topValues.reduce( (acc, curr) => acc + curr.doc_count, - _.get(aggregations, [...topAggsPath, 'sum_other_doc_count'], 0) + get(aggregations, [...topAggsPath, 'sum_other_doc_count'], 0) ), topValuesSamplerShardSize: field.cardinality >= SAMPLER_TOP_TERMS_THRESHOLD @@ -1046,12 +1047,12 @@ export class DataVisualizer { const batchStats: DateFieldStats[] = []; fields.forEach((field, i) => { const safeFieldName = getSafeAggregationName(field.fieldName, i); - const docCount = _.get( + const docCount = get( aggregations, [...aggsPath, `${safeFieldName}_field_stats`, 'doc_count'], 0 ); - const fieldStatsResp = _.get( + const fieldStatsResp = get( aggregations, [...aggsPath, `${safeFieldName}_field_stats`, 'actual_stats'], {} @@ -1059,8 +1060,8 @@ export class DataVisualizer { batchStats.push({ fieldName: field.fieldName, count: docCount, - earliest: _.get(fieldStatsResp, 'min', 0), - latest: _.get(fieldStatsResp, 'max', 0), + earliest: get(fieldStatsResp, 'min', 0), + latest: get(fieldStatsResp, 'max', 0), }); }); @@ -1115,17 +1116,17 @@ export class DataVisualizer { const safeFieldName = getSafeAggregationName(field.fieldName, i); const stats: BooleanFieldStats = { fieldName: field.fieldName, - count: _.get(aggregations, [...aggsPath, `${safeFieldName}_value_count`, 'doc_count'], 0), + count: get(aggregations, [...aggsPath, `${safeFieldName}_value_count`, 'doc_count'], 0), trueCount: 0, falseCount: 0, }; - const valueBuckets: Array<{ [key: string]: number }> = _.get( + const valueBuckets: Array<{ [key: string]: number }> = get( aggregations, [...aggsPath, `${safeFieldName}_values`, 'buckets'], [] ); - _.forEach(valueBuckets, (bucket) => { + valueBuckets.forEach((bucket) => { stats[`${bucket.key_as_string}Count`] = bucket.doc_count; }); @@ -1182,8 +1183,8 @@ export class DataVisualizer { // If the field is not in the _source (as will happen if the // field is populated using copy_to in the index mapping), // there will be no example to add. - // Use lodash _.get() to support field names containing dots. - const example: any = _.get(hits[i]._source, field); + // Use lodash get() to support field names containing dots. + const example: any = get(hits[i]._source, field); if (example !== undefined && stats.examples.indexOf(example) === -1) { stats.examples.push(example); if (stats.examples.length === maxExamples) { @@ -1216,7 +1217,7 @@ export class DataVisualizer { // Look ahead to the last percentiles and process these too if // they don't add more than 50% to the value range. - const lastValue = (_.last(percentileBuckets) as any).value; + const lastValue = (last(percentileBuckets) as any).value; const upperBound = lowerBound + 1.5 * (lastValue - lowerBound); const filteredLength = percentileBuckets.length; for (let i = filteredLength; i < percentiles.length; i++) { @@ -1237,7 +1238,7 @@ export class DataVisualizer { // Add in 0-5 and 95-100% if they don't add more // than 25% to the value range at either end. - const lastValue: number = (_.last(percentileBuckets) as any).value; + const lastValue: number = (last(percentileBuckets) as any).value; const maxDiff = 0.25 * (lastValue - lowerBound); if (lowerBound - dataMin < maxDiff) { percentileBuckets.splice(0, 0, percentiles[0]); diff --git a/x-pack/plugins/ml/server/models/job_validation/validate_cardinality.test.ts b/x-pack/plugins/ml/server/models/job_validation/validate_cardinality.test.ts index 92933877e28367..16ee70ad9efde6 100644 --- a/x-pack/plugins/ml/server/models/job_validation/validate_cardinality.test.ts +++ b/x-pack/plugins/ml/server/models/job_validation/validate_cardinality.test.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import _ from 'lodash'; +import cloneDeep from 'lodash/cloneDeep'; import { ILegacyScopedClusterClient } from 'kibana/server'; @@ -145,7 +145,7 @@ describe('ML - validateCardinality', () => { test: (ids: string[]) => void ) => { const job = getJobConfig(fieldName); - const mockCardinality = _.cloneDeep(mockResponses); + const mockCardinality = cloneDeep(mockResponses); mockCardinality.search.aggregations.airline_cardinality.value = cardinality; return validateCardinality( mlClusterClientFactory(mockCardinality), @@ -250,7 +250,7 @@ describe('ML - validateCardinality', () => { it(`disabled model_plot, over field cardinality of ${cardinality} doesn't trigger a warning`, () => { const job = (getJobConfig('over_field_name') as unknown) as CombinedJob; job.model_plot_config = { enabled: false }; - const mockCardinality = _.cloneDeep(mockResponses); + const mockCardinality = cloneDeep(mockResponses); mockCardinality.search.aggregations.airline_cardinality.value = cardinality; return validateCardinality(mlClusterClientFactory(mockCardinality), job).then((messages) => { const ids = messages.map((m) => m.id); @@ -261,7 +261,7 @@ describe('ML - validateCardinality', () => { it(`enabled model_plot, over field cardinality of ${cardinality} triggers a model plot warning`, () => { const job = (getJobConfig('over_field_name') as unknown) as CombinedJob; job.model_plot_config = { enabled: true }; - const mockCardinality = _.cloneDeep(mockResponses); + const mockCardinality = cloneDeep(mockResponses); mockCardinality.search.aggregations.airline_cardinality.value = cardinality; return validateCardinality(mlClusterClientFactory(mockCardinality), job).then((messages) => { const ids = messages.map((m) => m.id); @@ -272,7 +272,7 @@ describe('ML - validateCardinality', () => { it(`disabled model_plot, by field cardinality of ${cardinality} triggers a field cardinality warning`, () => { const job = (getJobConfig('by_field_name') as unknown) as CombinedJob; job.model_plot_config = { enabled: false }; - const mockCardinality = _.cloneDeep(mockResponses); + const mockCardinality = cloneDeep(mockResponses); mockCardinality.search.aggregations.airline_cardinality.value = cardinality; return validateCardinality(mlClusterClientFactory(mockCardinality), job).then((messages) => { const ids = messages.map((m) => m.id); @@ -283,7 +283,7 @@ describe('ML - validateCardinality', () => { it(`enabled model_plot, by field cardinality of ${cardinality} triggers a model plot warning and field cardinality warning`, () => { const job = (getJobConfig('by_field_name') as unknown) as CombinedJob; job.model_plot_config = { enabled: true }; - const mockCardinality = _.cloneDeep(mockResponses); + const mockCardinality = cloneDeep(mockResponses); mockCardinality.search.aggregations.airline_cardinality.value = cardinality; return validateCardinality(mlClusterClientFactory(mockCardinality), job).then((messages) => { const ids = messages.map((m) => m.id); @@ -294,7 +294,7 @@ describe('ML - validateCardinality', () => { it(`enabled model_plot with terms, by field cardinality of ${cardinality} triggers just field cardinality warning`, () => { const job = (getJobConfig('by_field_name') as unknown) as CombinedJob; job.model_plot_config = { enabled: true, terms: 'AAL,AAB' }; - const mockCardinality = _.cloneDeep(mockResponses); + const mockCardinality = cloneDeep(mockResponses); mockCardinality.search.aggregations.airline_cardinality.value = cardinality; return validateCardinality(mlClusterClientFactory(mockCardinality), job).then((messages) => { const ids = messages.map((m) => m.id); diff --git a/x-pack/plugins/ml/server/models/job_validation/validate_time_range.test.ts b/x-pack/plugins/ml/server/models/job_validation/validate_time_range.test.ts index f74d8a26ef3704..a45be189ba3d8f 100644 --- a/x-pack/plugins/ml/server/models/job_validation/validate_time_range.test.ts +++ b/x-pack/plugins/ml/server/models/job_validation/validate_time_range.test.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import _ from 'lodash'; +import cloneDeep from 'lodash/cloneDeep'; import { ILegacyScopedClusterClient } from 'kibana/server'; @@ -144,7 +144,7 @@ describe('ML - validateTimeRange', () => { }); it('invalid time field', () => { - const mockSearchResponseInvalid = _.cloneDeep(mockSearchResponse); + const mockSearchResponseInvalid = cloneDeep(mockSearchResponse); mockSearchResponseInvalid.fieldCaps = undefined; const duration = { start: 0, end: 1 }; return validateTimeRange( diff --git a/x-pack/plugins/ml/server/models/results_service/build_anomaly_table_items.js b/x-pack/plugins/ml/server/models/results_service/build_anomaly_table_items.js index e664a1403d7d63..588e0e10a8d630 100644 --- a/x-pack/plugins/ml/server/models/results_service/build_anomaly_table_items.js +++ b/x-pack/plugins/ml/server/models/results_service/build_anomaly_table_items.js @@ -4,7 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import _ from 'lodash'; +import sortBy from 'lodash/sortBy'; +import each from 'lodash/each'; import moment from 'moment-timezone'; import { @@ -55,7 +56,7 @@ export function buildAnomalyTableItems(anomalyRecords, aggregationInterval, date if (source.influencers !== undefined) { const influencers = []; - const sourceInfluencers = _.sortBy(source.influencers, 'influencer_field_name'); + const sourceInfluencers = sortBy(source.influencers, 'influencer_field_name'); sourceInfluencers.forEach((influencer) => { const influencerFieldName = influencer.influencer_field_name; influencer.influencer_field_values.forEach((influencerFieldValue) => { @@ -172,10 +173,10 @@ function aggregateAnomalies(anomalyRecords, interval, dateFormatTz) { // Flatten the aggregatedData to give a list of records with // the highest score per bucketed time / jobId / detectorIndex. const summaryRecords = []; - _.each(aggregatedData, (times, roundedTime) => { - _.each(times, (jobIds) => { - _.each(jobIds, (entityDetectors) => { - _.each(entityDetectors, (record) => { + each(aggregatedData, (times, roundedTime) => { + each(times, (jobIds) => { + each(jobIds, (entityDetectors) => { + each(entityDetectors, (record) => { summaryRecords.push({ time: +roundedTime, source: record, diff --git a/x-pack/plugins/ml/server/models/results_service/results_service.ts b/x-pack/plugins/ml/server/models/results_service/results_service.ts index 04997e517bba9f..8e71384942b573 100644 --- a/x-pack/plugins/ml/server/models/results_service/results_service.ts +++ b/x-pack/plugins/ml/server/models/results_service/results_service.ts @@ -4,7 +4,9 @@ * you may not use this file except in compliance with the Elastic License. */ -import _ from 'lodash'; +import sortBy from 'lodash/sortBy'; +import slice from 'lodash/slice'; +import get from 'lodash/get'; import moment from 'moment'; import { SearchResponse } from 'elasticsearch'; import { ILegacyScopedClusterClient } from 'kibana/server'; @@ -175,7 +177,7 @@ export function resultsServiceProvider(mlClusterClient: ILegacyScopedClusterClie }); // Sort anomalies in ascending time order. - records = _.sortBy(records, 'timestamp'); + records = sortBy(records, 'timestamp'); tableData.interval = aggregationInterval; if (aggregationInterval === 'auto') { // Determine the actual interval to use if aggregating. @@ -197,7 +199,7 @@ export function resultsServiceProvider(mlClusterClient: ILegacyScopedClusterClie const categoryIdsByJobId: { [key: string]: any } = {}; categoryAnomalies.forEach((anomaly) => { - if (!_.has(categoryIdsByJobId, anomaly.jobId)) { + if (categoryIdsByJobId[anomaly.jobId] === undefined) { categoryIdsByJobId[anomaly.jobId] = []; } if (categoryIdsByJobId[anomaly.jobId].indexOf(anomaly.entityValue) === -1) { @@ -289,7 +291,7 @@ export function resultsServiceProvider(mlClusterClient: ILegacyScopedClusterClie }; const resp = await callAsInternalUser('search', query); - const maxScore = _.get(resp, ['aggregations', 'max_score', 'value'], null); + const maxScore = get(resp, ['aggregations', 'max_score', 'value'], null); return { maxScore }; } @@ -353,7 +355,7 @@ export function resultsServiceProvider(mlClusterClient: ILegacyScopedClusterClie }, }); - const bucketsByJobId: Array<{ key: string; maxTimestamp: { value?: number } }> = _.get( + const bucketsByJobId: Array<{ key: string; maxTimestamp: { value?: number } }> = get( resp, ['aggregations', 'byJobId', 'buckets'], [] @@ -387,7 +389,7 @@ export function resultsServiceProvider(mlClusterClient: ILegacyScopedClusterClie if (resp.hits.total !== 0) { resp.hits.hits.forEach((hit: any) => { if (maxExamples) { - examplesByCategoryId[hit._source.category_id] = _.slice( + examplesByCategoryId[hit._source.category_id] = slice( hit._source.examples, 0, Math.min(hit._source.examples.length, maxExamples) diff --git a/x-pack/plugins/reporting/public/components/__snapshots__/report_listing.test.tsx.snap b/x-pack/plugins/reporting/public/components/__snapshots__/report_listing.test.tsx.snap index ddba7842f11998..66c3aea8acc13c 100644 --- a/x-pack/plugins/reporting/public/components/__snapshots__/report_listing.test.tsx.snap +++ b/x-pack/plugins/reporting/public/components/__snapshots__/report_listing.test.tsx.snap @@ -30,6 +30,7 @@ Array [ }, ] } + data-test-page={0} data-test-subj="reportJobListing" isSelectable={true} itemId="id" @@ -56,6 +57,7 @@ Array [ >
@@ -366,6 +368,7 @@ Array [ ,
diff --git a/x-pack/plugins/reporting/public/components/report_listing.tsx b/x-pack/plugins/reporting/public/components/report_listing.tsx index afcae93a8db16f..80ef9311fd0e54 100644 --- a/x-pack/plugins/reporting/public/components/report_listing.tsx +++ b/x-pack/plugins/reporting/public/components/report_listing.tsx @@ -513,6 +513,7 @@ class ReportListingUi extends Component { isSelectable={true} onChange={this.onTableChange} data-test-subj="reportJobListing" + data-test-page={this.state.page} /> {this.state.selectedJobs.length > 0 ? this.renderDeleteButton() : null} diff --git a/x-pack/plugins/reporting/server/routes/jobs.ts b/x-pack/plugins/reporting/server/routes/jobs.ts index 4033719b053ba4..e8eac9e577beb5 100644 --- a/x-pack/plugins/reporting/server/routes/jobs.ts +++ b/x-pack/plugins/reporting/server/routes/jobs.ts @@ -35,7 +35,13 @@ export function registerJobInfoRoutes(reporting: ReportingCore) { router.get( { path: `${MAIN_ENTRY}/list`, - validate: false, + validate: { + query: schema.object({ + page: schema.string({ defaultValue: '0' }), + size: schema.string({ defaultValue: '10' }), + ids: schema.maybe(schema.string()), + }), + }, }, userHandler(async (user, context, req, res) => { // ensure the async dependencies are loaded @@ -50,7 +56,7 @@ export function registerJobInfoRoutes(reporting: ReportingCore) { page: queryPage = '0', size: querySize = '10', ids: queryIds = null, - } = req.query as ListQuery; + } = req.query as ListQuery; // NOTE: type inference is not working here. userHandler breaks it? const page = parseInt(queryPage, 10) || 0; const size = Math.min(100, parseInt(querySize, 10) || 10); const jobIds = queryIds ? queryIds.split(',') : null; diff --git a/x-pack/plugins/security_solution/common/endpoint/models/event.ts b/x-pack/plugins/security_solution/common/endpoint/models/event.ts index 30e11819c02721..a0e9be58911c6b 100644 --- a/x-pack/plugins/security_solution/common/endpoint/models/event.ts +++ b/x-pack/plugins/security_solution/common/endpoint/models/event.ts @@ -55,6 +55,25 @@ export function timestampSafeVersion(event: SafeResolverEvent): string | undefin : firstNonNullValue(event?.['@timestamp']); } +/** + * The `@timestamp` for the event, as a `Date` object. + * If `@timestamp` couldn't be parsed as a `Date`, returns `undefined`. + */ +export function timestampAsDateSafeVersion(event: SafeResolverEvent): Date | undefined { + const value = timestampSafeVersion(event); + if (value === undefined) { + return undefined; + } + + const date = new Date(value); + // Check if the date is valid + if (isFinite(date.getTime())) { + return date; + } else { + return undefined; + } +} + export function eventTimestamp(event: ResolverEvent): string | undefined | number { if (isLegacyEvent(event)) { return event.endgame.timestamp_utc; diff --git a/x-pack/plugins/security_solution/public/cases/components/configure_cases/index.tsx b/x-pack/plugins/security_solution/public/cases/components/configure_cases/index.tsx index e2e3a600a95ff6..63b271b8cce78a 100644 --- a/x-pack/plugins/security_solution/public/cases/components/configure_cases/index.tsx +++ b/x-pack/plugins/security_solution/public/cases/components/configure_cases/index.tsx @@ -42,6 +42,9 @@ const FormWrapper = styled.div` padding-top: ${theme.eui.paddingSizes.xl}; padding-bottom: ${theme.eui.paddingSizes.xl}; + .euiFlyout { + z-index: ${theme.eui.euiZNavigation + 1}; + } `} `; diff --git a/x-pack/plugins/security_solution/public/common/components/autocomplete/field.test.tsx b/x-pack/plugins/security_solution/public/common/components/autocomplete/field.test.tsx index 30864f246071bc..a678deae41542e 100644 --- a/x-pack/plugins/security_solution/public/common/components/autocomplete/field.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/autocomplete/field.test.tsx @@ -12,7 +12,7 @@ import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui'; import { fields, getField, -} from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +} from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { FieldComponent } from './field'; describe('FieldComponent', () => { diff --git a/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_lists.test.tsx b/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_lists.test.tsx index eca38b9effe1b6..eef6e09d496dbe 100644 --- a/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_lists.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_lists.test.tsx @@ -11,7 +11,7 @@ import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui'; // we don't have the types for waitFor just yet, so using "as waitFor" until when we do import { wait as waitFor } from '@testing-library/react'; -import { getField } from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +import { getField } from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { ListSchema } from '../../../lists_plugin_deps'; import { getFoundListSchemaMock } from '../../../../../lists/common/schemas/response/found_list_schema.mock'; import { getListResponseMock } from '../../../../../lists/common/schemas/response/list_schema.mock'; diff --git a/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match.test.tsx b/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match.test.tsx index 998ed1f3351c80..94040ccb639bee 100644 --- a/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match.test.tsx @@ -12,7 +12,7 @@ import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui'; import { fields, getField, -} from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +} from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { AutocompleteFieldMatchComponent } from './field_value_match'; import { useFieldValueAutocomplete } from './hooks/use_field_value_autocomplete'; jest.mock('./hooks/use_field_value_autocomplete'); diff --git a/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match_any.test.tsx b/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match_any.test.tsx index 0a0281a9c4a51a..4074150f76d06e 100644 --- a/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match_any.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match_any.test.tsx @@ -12,7 +12,7 @@ import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui'; import { fields, getField, -} from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +} from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { AutocompleteFieldMatchAnyComponent } from './field_value_match_any'; import { useFieldValueAutocomplete } from './hooks/use_field_value_autocomplete'; jest.mock('./hooks/use_field_value_autocomplete'); diff --git a/x-pack/plugins/security_solution/public/common/components/autocomplete/helpers.test.ts b/x-pack/plugins/security_solution/public/common/components/autocomplete/helpers.test.ts index 289cdd5e87c00f..bbcbcbcf928b3a 100644 --- a/x-pack/plugins/security_solution/public/common/components/autocomplete/helpers.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/autocomplete/helpers.test.ts @@ -5,7 +5,7 @@ */ import '../../../common/mock/match_media'; -import { getField } from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +import { getField } from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { EXCEPTION_OPERATORS, diff --git a/x-pack/plugins/security_solution/public/common/components/autocomplete/hooks/use_field_value_autocomplete.test.ts b/x-pack/plugins/security_solution/public/common/components/autocomplete/hooks/use_field_value_autocomplete.test.ts index a76b50d11a8757..82e9c21f6b8396 100644 --- a/x-pack/plugins/security_solution/public/common/components/autocomplete/hooks/use_field_value_autocomplete.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/autocomplete/hooks/use_field_value_autocomplete.test.ts @@ -13,7 +13,7 @@ import { } from './use_field_value_autocomplete'; import { useKibana } from '../../../../common/lib/kibana'; import { stubIndexPatternWithFields } from '../../../../../../../../src/plugins/data/common/index_patterns/index_pattern.stub'; -import { getField } from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +import { getField } from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { OperatorTypeEnum } from '../../../../lists_plugin_deps'; jest.mock('../../../../common/lib/kibana'); diff --git a/x-pack/plugins/security_solution/public/common/components/autocomplete/operator.test.tsx b/x-pack/plugins/security_solution/public/common/components/autocomplete/operator.test.tsx index 737be199e24811..e6f6227811085e 100644 --- a/x-pack/plugins/security_solution/public/common/components/autocomplete/operator.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/autocomplete/operator.test.tsx @@ -9,7 +9,7 @@ import { mount } from 'enzyme'; import euiLightVars from '@elastic/eui/dist/eui_theme_light.json'; import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui'; -import { getField } from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +import { getField } from '../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { OperatorComponent } from './operator'; import { isOperator, isNotOperator } from './operators'; diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/builder/entry_item.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/builder/entry_item.test.tsx index 2a116c4cd8acf5..59a5db2a097796 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/builder/entry_item.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/builder/entry_item.test.tsx @@ -22,7 +22,7 @@ import { import { fields, getField, -} from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +} from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { getFoundListSchemaMock } from '../../../../../../lists/common/schemas/response/found_list_schema.mock'; import { getEmptyValue } from '../../empty_value'; diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/builder/exception_item.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/builder/exception_item.test.tsx index e90639a2c0285f..0f9be25e046b24 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/builder/exception_item.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/builder/exception_item.test.tsx @@ -10,7 +10,7 @@ import { mount } from 'enzyme'; import euiLightVars from '@elastic/eui/dist/eui_theme_light.json'; import { useKibana } from '../../../../common/lib/kibana'; -import { fields } from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +import { fields } from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { getExceptionListItemSchemaMock } from '../../../../../../lists/common/schemas/response/exception_list_item_schema.mock'; import { getEntryMatchMock } from '../../../../../../lists/common/schemas/types/entry_match.mock'; import { getEntryMatchAnyMock } from '../../../../../../lists/common/schemas/types/entry_match_any.mock'; diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/builder/helpers.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/builder/helpers.test.tsx index 04ab9ee7216f7e..9bfd04cc19d724 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/builder/helpers.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/builder/helpers.test.tsx @@ -6,7 +6,7 @@ import { fields, getField, -} from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +} from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { getEntryNestedMock } from '../../../../../../lists/common/schemas/types/entry_nested.mock'; import { getEntryMatchMock } from '../../../../../../lists/common/schemas/types/entry_match.mock'; import { getEntryMatchAnyMock } from '../../../../../../lists/common/schemas/types/entry_match_any.mock'; diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/builder/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/builder/index.test.tsx index 3fa0e59f9acb0c..2d389a7dbcee1a 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/builder/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/builder/index.test.tsx @@ -13,7 +13,7 @@ import { wait as waitFor } from '@testing-library/react'; import { fields, getField, -} from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks.ts'; +} from '../../../../../../../../src/plugins/data/common/index_patterns/fields/fields.mocks'; import { getExceptionListItemSchemaMock } from '../../../../../../lists/common/schemas/response/exception_list_item_schema.mock'; import { getEntryMatchAnyMock } from '../../../../../../lists/common/schemas/types/entry_match_any.mock'; diff --git a/x-pack/plugins/security_solution/public/common/components/header_global/index.tsx b/x-pack/plugins/security_solution/public/common/components/header_global/index.tsx index fbc3d62768d003..e05e3c2e9aeb13 100644 --- a/x-pack/plugins/security_solution/public/common/components/header_global/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/header_global/index.tsx @@ -41,14 +41,15 @@ const FlexItem = styled(EuiFlexItem)` `; FlexItem.displayName = 'FlexItem'; -const FlexGroup = styled(EuiFlexGroup)<{ $globalFullScreen: boolean }>` - ${({ $globalFullScreen, theme }) => ` +const FlexGroup = styled(EuiFlexGroup)<{ $globalFullScreen: boolean; $hasSibling: boolean }>` + ${({ $globalFullScreen, $hasSibling, theme }) => ` border-bottom: ${theme.eui.euiBorderThin}; margin-bottom: 1px; padding-bottom: 4px; padding-left: ${theme.eui.paddingSizes.l}; padding-right: ${gutterTimeline}; ${$globalFullScreen ? 'display: none;' : ''} + ${$hasSibling ? `border-bottom: ${theme.eui.euiBorderThin};` : 'border-bottom-width: 0px;'} `} `; FlexGroup.displayName = 'FlexGroup'; @@ -75,6 +76,7 @@ export const HeaderGlobal = React.memo(({ hideDetectionEngine diff --git a/x-pack/plugins/security_solution/public/common/components/top_n/index.tsx b/x-pack/plugins/security_solution/public/common/components/top_n/index.tsx index 807f1839973fa9..d71242329bcda9 100644 --- a/x-pack/plugins/security_solution/public/common/components/top_n/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/top_n/index.tsx @@ -104,7 +104,7 @@ const StatefulTopNComponent: React.FC = ({ value, }) => { const kibana = useKibana(); - const { from, deleteQuery, setQuery, to } = useGlobalTime(); + const { from, deleteQuery, setQuery, to } = useGlobalTime(false); const options = getOptions( timelineId === TimelineId.active ? activeTimelineEventType : undefined diff --git a/x-pack/plugins/security_solution/public/common/containers/use_global_time/index.test.tsx b/x-pack/plugins/security_solution/public/common/containers/use_global_time/index.test.tsx index 9d5f1740b02768..07ce3551e32898 100644 --- a/x-pack/plugins/security_solution/public/common/containers/use_global_time/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/containers/use_global_time/index.test.tsx @@ -8,17 +8,22 @@ import { act, renderHook } from '@testing-library/react-hooks'; import { useGlobalTime } from '.'; +const mockDispatch = jest.fn(); + jest.mock('react-redux', () => { const originalModule = jest.requireActual('react-redux'); return { ...originalModule, - useDispatch: jest.fn().mockReturnValue(jest.fn()), + useDispatch: () => mockDispatch, useSelector: jest.fn().mockReturnValue({ from: 0, to: 0 }), }; }); describe('useGlobalTime', () => { + beforeEach(() => { + mockDispatch.mockReset(); + }); test('returns memoized value', () => { const { result, rerender } = renderHook(() => useGlobalTime()); @@ -30,4 +35,18 @@ describe('useGlobalTime', () => { expect(result1.from).toBe(0); expect(result1.to).toBe(0); }); + + test('clear all queries at unmount', () => { + const { rerender } = renderHook(() => useGlobalTime()); + act(() => rerender()); + expect(mockDispatch.mock.calls[0][0].type).toEqual( + 'x-pack/security_solution/local/inputs/DELETE_ALL_QUERY' + ); + }); + + test('do NOT clear all queries at unmount', () => { + const { rerender } = renderHook(() => useGlobalTime(false)); + act(() => rerender()); + expect(mockDispatch.mock.calls.length).toBe(0); + }); }); diff --git a/x-pack/plugins/security_solution/public/common/containers/use_global_time/index.tsx b/x-pack/plugins/security_solution/public/common/containers/use_global_time/index.tsx index b63616ecbcf563..52825caf9ce74a 100644 --- a/x-pack/plugins/security_solution/public/common/containers/use_global_time/index.tsx +++ b/x-pack/plugins/security_solution/public/common/containers/use_global_time/index.tsx @@ -11,7 +11,7 @@ import { inputsSelectors } from '../../store'; import { inputsActions } from '../../store/actions'; import { SetQuery, DeleteQuery } from './types'; -export const useGlobalTime = () => { +export const useGlobalTime = (clearAllQuery: boolean = true) => { const dispatch = useDispatch(); const { from, to } = useSelector(inputsSelectors.globalTimeRangeSelector); const [isInitializing, setIsInitializing] = useState(true); @@ -32,9 +32,11 @@ export const useGlobalTime = () => { setIsInitializing(false); } return () => { - dispatch(inputsActions.deleteAllQuery({ id: 'global' })); + if (clearAllQuery) { + dispatch(inputsActions.deleteAllQuery({ id: 'global' })); + } }; - }, [dispatch, isInitializing]); + }, [clearAllQuery, dispatch, isInitializing]); const memoizedReturn = useMemo( () => ({ diff --git a/x-pack/plugins/security_solution/public/common/store/actions.ts b/x-pack/plugins/security_solution/public/common/store/actions.ts index f2072aae1936f1..cd8836e38bfef1 100644 --- a/x-pack/plugins/security_solution/public/common/store/actions.ts +++ b/x-pack/plugins/security_solution/public/common/store/actions.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { HostAction } from '../../management/pages/endpoint_hosts/store/action'; +import { EndpointAction } from '../../management/pages/endpoint_hosts/store/action'; import { PolicyListAction } from '../../management/pages/policy/store/policy_list'; import { PolicyDetailsAction } from '../../management/pages/policy/store/policy_details'; @@ -13,4 +13,4 @@ export { dragAndDropActions } from './drag_and_drop'; export { inputsActions } from './inputs'; import { RoutingAction } from './routing'; -export type AppAction = HostAction | RoutingAction | PolicyListAction | PolicyDetailsAction; +export type AppAction = EndpointAction | RoutingAction | PolicyListAction | PolicyDetailsAction; diff --git a/x-pack/plugins/security_solution/public/management/common/constants.ts b/x-pack/plugins/security_solution/public/management/common/constants.ts index b07c47a3980498..88396cc24a5e24 100644 --- a/x-pack/plugins/security_solution/public/management/common/constants.ts +++ b/x-pack/plugins/security_solution/public/management/common/constants.ts @@ -10,7 +10,7 @@ import { SecurityPageName } from '../../app/types'; // --[ ROUTING ]--------------------------------------------------------------------------- export const MANAGEMENT_APP_ID = `${APP_ID}:${SecurityPageName.administration}`; export const MANAGEMENT_ROUTING_ROOT_PATH = ''; -export const MANAGEMENT_ROUTING_HOSTS_PATH = `${MANAGEMENT_ROUTING_ROOT_PATH}/:tabName(${AdministrationSubTab.hosts})`; +export const MANAGEMENT_ROUTING_ENDPOINTS_PATH = `${MANAGEMENT_ROUTING_ROOT_PATH}/:tabName(${AdministrationSubTab.endpoints})`; export const MANAGEMENT_ROUTING_POLICIES_PATH = `${MANAGEMENT_ROUTING_ROOT_PATH}/:tabName(${AdministrationSubTab.policies})`; export const MANAGEMENT_ROUTING_POLICY_DETAILS_PATH = `${MANAGEMENT_ROUTING_ROOT_PATH}/:tabName(${AdministrationSubTab.policies})/:policyId`; @@ -21,5 +21,5 @@ export const MANAGEMENT_STORE_GLOBAL_NAMESPACE: ManagementStoreGlobalNamespace = export const MANAGEMENT_STORE_POLICY_LIST_NAMESPACE = 'policyList'; /** Namespace within the Management state where policy details state is maintained */ export const MANAGEMENT_STORE_POLICY_DETAILS_NAMESPACE = 'policyDetails'; -/** Namespace within the Management state where hosts state is maintained */ -export const MANAGEMENT_STORE_HOSTS_NAMESPACE = 'hosts'; +/** Namespace within the Management state where endpoint-host state is maintained */ +export const MANAGEMENT_STORE_ENDPOINTS_NAMESPACE = 'endpoints'; diff --git a/x-pack/plugins/security_solution/public/management/common/routing.ts b/x-pack/plugins/security_solution/public/management/common/routing.ts index eeb1533f57a67a..ea162422abb6fc 100644 --- a/x-pack/plugins/security_solution/public/management/common/routing.ts +++ b/x-pack/plugins/security_solution/public/management/common/routing.ts @@ -10,13 +10,13 @@ import { generatePath } from 'react-router-dom'; import querystring from 'querystring'; import { - MANAGEMENT_ROUTING_HOSTS_PATH, + MANAGEMENT_ROUTING_ENDPOINTS_PATH, MANAGEMENT_ROUTING_POLICIES_PATH, MANAGEMENT_ROUTING_POLICY_DETAILS_PATH, } from './constants'; import { AdministrationSubTab } from '../types'; import { appendSearch } from '../../common/components/link_to/helpers'; -import { HostIndexUIQueryParams } from '../pages/endpoint_hosts/types'; +import { EndpointIndexUIQueryParams } from '../pages/endpoint_hosts/types'; // Taken from: https://github.com/microsoft/TypeScript/issues/12936#issuecomment-559034150 type ExactKeys = Exclude extends never ? T1 : never; @@ -31,42 +31,44 @@ const querystringStringify: ( params: Exact ) => string = querystring.stringify; -/** Make `selected_host` required */ -type HostDetailsUrlProps = Omit & - Required>; +/** Make `selected_endpoint` required */ +type EndpointDetailsUrlProps = Omit & + Required>; -export const getHostListPath = ( - props: { name: 'default' | 'hostList' } & HostIndexUIQueryParams, +export const getEndpointListPath = ( + props: { name: 'default' | 'endpointList' } & EndpointIndexUIQueryParams, search?: string ) => { const { name, ...queryParams } = props; - const urlQueryParams = querystringStringify( + const urlQueryParams = querystringStringify( queryParams ); const urlSearch = `${urlQueryParams && !isEmpty(search) ? '&' : ''}${search ?? ''}`; - if (name === 'hostList') { - return `${generatePath(MANAGEMENT_ROUTING_HOSTS_PATH, { - tabName: AdministrationSubTab.hosts, + if (name === 'endpointList') { + return `${generatePath(MANAGEMENT_ROUTING_ENDPOINTS_PATH, { + tabName: AdministrationSubTab.endpoints, })}${appendSearch(`${urlQueryParams ? `${urlQueryParams}${urlSearch}` : urlSearch}`)}`; } return `${appendSearch(`${urlQueryParams ? `${urlQueryParams}${urlSearch}` : urlSearch}`)}`; }; -export const getHostDetailsPath = ( - props: { name: 'hostDetails' | 'hostPolicyResponse' } & HostIndexUIQueryParams & - HostDetailsUrlProps, +export const getEndpointDetailsPath = ( + props: { name: 'endpointDetails' | 'endpointPolicyResponse' } & EndpointIndexUIQueryParams & + EndpointDetailsUrlProps, search?: string ) => { const { name, ...queryParams } = props; - queryParams.show = (props.name === 'hostPolicyResponse' + queryParams.show = (props.name === 'endpointPolicyResponse' ? 'policy_response' - : '') as HostIndexUIQueryParams['show']; - const urlQueryParams = querystringStringify(queryParams); + : '') as EndpointIndexUIQueryParams['show']; + const urlQueryParams = querystringStringify( + queryParams + ); const urlSearch = `${urlQueryParams && !isEmpty(search) ? '&' : ''}${search ?? ''}`; - return `${generatePath(MANAGEMENT_ROUTING_HOSTS_PATH, { - tabName: AdministrationSubTab.hosts, + return `${generatePath(MANAGEMENT_ROUTING_ENDPOINTS_PATH, { + tabName: AdministrationSubTab.endpoints, })}${appendSearch(`${urlQueryParams ? `${urlQueryParams}${urlSearch}` : urlSearch}`)}`; }; diff --git a/x-pack/plugins/security_solution/public/management/common/translations.ts b/x-pack/plugins/security_solution/public/management/common/translations.ts index 70ccf715eaa099..03f6a80ef99a4f 100644 --- a/x-pack/plugins/security_solution/public/management/common/translations.ts +++ b/x-pack/plugins/security_solution/public/management/common/translations.ts @@ -6,8 +6,8 @@ import { i18n } from '@kbn/i18n'; -export const HOSTS_TAB = i18n.translate('xpack.securitySolution.hostsTab', { - defaultMessage: 'Hosts', +export const ENDPOINTS_TAB = i18n.translate('xpack.securitySolution.endpointsTab', { + defaultMessage: 'Endpoints', }); export const POLICIES_TAB = i18n.translate('xpack.securitySolution.policiesTab', { diff --git a/x-pack/plugins/security_solution/public/management/components/management_empty_state.tsx b/x-pack/plugins/security_solution/public/management/components/management_empty_state.tsx index a4518d1a1f4937..4617865d6aa6d5 100644 --- a/x-pack/plugins/security_solution/public/management/components/management_empty_state.tsx +++ b/x-pack/plugins/security_solution/public/management/components/management_empty_state.tsx @@ -116,7 +116,7 @@ const PolicyEmptyState = React.memo<{ ); }); -const HostsEmptyState = React.memo<{ +const EndpointsEmptyState = React.memo<{ loading: boolean; onActionClick: (event: MouseEvent) => void; actionDisabled: boolean; @@ -126,14 +126,14 @@ const HostsEmptyState = React.memo<{ const policySteps = useMemo( () => [ { - title: i18n.translate('xpack.securitySolution.endpoint.hostList.stepOneTitle', { + title: i18n.translate('xpack.securitySolution.endpoint.list.stepOneTitle', { defaultMessage: 'Select the integration you want to use', }), children: ( <> @@ -151,7 +151,7 @@ const HostsEmptyState = React.memo<{ return loading ? ( @@ -159,7 +159,7 @@ const HostsEmptyState = React.memo<{ list ) : ( ); @@ -169,7 +169,7 @@ const HostsEmptyState = React.memo<{ ), }, { - title: i18n.translate('xpack.securitySolution.endpoint.hostList.stepTwoTitle', { + title: i18n.translate('xpack.securitySolution.endpoint.list.stepTwoTitle', { defaultMessage: 'Enroll your agents enabled with Endpoint Security through Ingest Manager', }), @@ -179,7 +179,7 @@ const HostsEmptyState = React.memo<{ @@ -211,13 +211,13 @@ const HostsEmptyState = React.memo<{ steps={policySteps} headerComponent={ } bodyComponent={ } @@ -265,7 +265,7 @@ const ManagementEmptyState = React.memo<{ }); PolicyEmptyState.displayName = 'PolicyEmptyState'; -HostsEmptyState.displayName = 'HostsEmptyState'; +EndpointsEmptyState.displayName = 'HostsEmptyState'; ManagementEmptyState.displayName = 'ManagementEmptyState'; -export { PolicyEmptyState, HostsEmptyState }; +export { PolicyEmptyState, EndpointsEmptyState as HostsEmptyState }; diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/index.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/index.tsx index a970edd4d30f4d..23e55301d22cbf 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/index.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/index.tsx @@ -6,20 +6,20 @@ import { Switch, Route } from 'react-router-dom'; import React, { memo } from 'react'; -import { HostList } from './view'; -import { MANAGEMENT_ROUTING_HOSTS_PATH } from '../../common/constants'; +import { EndpointList } from './view'; +import { MANAGEMENT_ROUTING_ENDPOINTS_PATH } from '../../common/constants'; import { NotFoundPage } from '../../../app/404'; /** * Provides the routing container for the hosts related views */ -export const HostsContainer = memo(() => { +export const EndpointsContainer = memo(() => { return ( - + ); }); -HostsContainer.displayName = 'HostsContainer'; +EndpointsContainer.displayName = 'EndpointsContainer'; diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/routes.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/routes.tsx index 3f92358b93d56d..727d2715f0974d 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/routes.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/routes.tsx @@ -7,12 +7,12 @@ import React from 'react'; import { Route, Switch } from 'react-router-dom'; -import { HostList } from './view'; +import { EndpointList } from './view'; export const EndpointHostsRoutes: React.FC = () => ( - - + + ); diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/action.ts b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/action.ts index 4a4326d5b29193..2e188af41d2d70 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/action.ts +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/action.ts @@ -12,35 +12,35 @@ import { import { ServerApiError } from '../../../../common/types'; import { GetPolicyListResponse } from '../../policy/types'; import { GetPackagesResponse } from '../../../../../../ingest_manager/common'; -import { HostState } from '../types'; +import { EndpointState } from '../types'; -interface ServerReturnedHostList { - type: 'serverReturnedHostList'; +interface ServerReturnedEndpointList { + type: 'serverReturnedEndpointList'; payload: HostResultList; } -interface ServerFailedToReturnHostList { - type: 'serverFailedToReturnHostList'; +interface ServerFailedToReturnEndpointList { + type: 'serverFailedToReturnEndpointList'; payload: ServerApiError; } -interface ServerReturnedHostDetails { - type: 'serverReturnedHostDetails'; +interface ServerReturnedEndpointDetails { + type: 'serverReturnedEndpointDetails'; payload: HostInfo; } -interface ServerFailedToReturnHostDetails { - type: 'serverFailedToReturnHostDetails'; +interface ServerFailedToReturnEndpointDetails { + type: 'serverFailedToReturnEndpointDetails'; payload: ServerApiError; } -interface ServerReturnedHostPolicyResponse { - type: 'serverReturnedHostPolicyResponse'; +interface ServerReturnedEndpointPolicyResponse { + type: 'serverReturnedEndpointPolicyResponse'; payload: GetHostPolicyResponse; } -interface ServerFailedToReturnHostPolicyResponse { - type: 'serverFailedToReturnHostPolicyResponse'; +interface ServerFailedToReturnEndpointPolicyResponse { + type: 'serverFailedToReturnEndpointPolicyResponse'; payload: ServerApiError; } @@ -63,8 +63,8 @@ interface UserSelectedEndpointPolicy { }; } -interface ServerCancelledHostListLoading { - type: 'serverCancelledHostListLoading'; +interface ServerCancelledEndpointListLoading { + type: 'serverCancelledEndpointListLoading'; } interface ServerCancelledPolicyItemsLoading { @@ -76,28 +76,28 @@ interface ServerReturnedEndpointPackageInfo { payload: GetPackagesResponse['response'][0]; } -interface ServerReturnedHostNonExistingPolicies { - type: 'serverReturnedHostNonExistingPolicies'; - payload: HostState['nonExistingPolicies']; +interface ServerReturnedEndpointNonExistingPolicies { + type: 'serverReturnedEndpointNonExistingPolicies'; + payload: EndpointState['nonExistingPolicies']; } -interface ServerReturnedHostExistValue { - type: 'serverReturnedHostExistValue'; +interface ServerReturnedEndpointExistValue { + type: 'serverReturnedEndpointExistValue'; payload: boolean; } -export type HostAction = - | ServerReturnedHostList - | ServerFailedToReturnHostList - | ServerReturnedHostDetails - | ServerFailedToReturnHostDetails - | ServerReturnedHostPolicyResponse - | ServerFailedToReturnHostPolicyResponse +export type EndpointAction = + | ServerReturnedEndpointList + | ServerFailedToReturnEndpointList + | ServerReturnedEndpointDetails + | ServerFailedToReturnEndpointDetails + | ServerReturnedEndpointPolicyResponse + | ServerFailedToReturnEndpointPolicyResponse | ServerReturnedPoliciesForOnboarding | ServerFailedToReturnPoliciesForOnboarding | UserSelectedEndpointPolicy - | ServerCancelledHostListLoading - | ServerReturnedHostExistValue + | ServerCancelledEndpointListLoading + | ServerReturnedEndpointExistValue | ServerCancelledPolicyItemsLoading | ServerReturnedEndpointPackageInfo - | ServerReturnedHostNonExistingPolicies; + | ServerReturnedEndpointNonExistingPolicies; diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/host_pagination.test.ts b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/endpoint_pagination.test.ts similarity index 80% rename from x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/host_pagination.test.ts rename to x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/endpoint_pagination.test.ts index 533b14e50f3dd4..0fd970f4bed123 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/host_pagination.test.ts +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/endpoint_pagination.test.ts @@ -13,41 +13,41 @@ import { coreMock } from '../../../../../../../../src/core/public/mocks'; import { HostResultList, AppLocation } from '../../../../../common/endpoint/types'; import { DepsStartMock, depsStartMock } from '../../../../common/mock/endpoint'; -import { hostMiddlewareFactory } from './middleware'; +import { endpointMiddlewareFactory } from './middleware'; -import { hostListReducer } from './reducer'; +import { endpointListReducer } from './reducer'; import { uiQueryParams } from './selectors'; -import { mockHostResultList } from './mock_host_result_list'; -import { HostState, HostIndexUIQueryParams } from '../types'; +import { mockEndpointResultList } from './mock_endpoint_result_list'; +import { EndpointState, EndpointIndexUIQueryParams } from '../types'; import { MiddlewareActionSpyHelper, createSpyMiddleware, } from '../../../../common/store/test_utils'; -import { getHostListPath } from '../../../common/routing'; +import { getEndpointListPath } from '../../../common/routing'; -describe('host list pagination: ', () => { +describe('endpoint list pagination: ', () => { let fakeCoreStart: jest.Mocked; let depsStart: DepsStartMock; let fakeHttpServices: jest.Mocked; let history: History; let store: Store; - let queryParams: () => HostIndexUIQueryParams; + let queryParams: () => EndpointIndexUIQueryParams; let waitForAction: MiddlewareActionSpyHelper['waitForAction']; let actionSpyMiddleware; const getEndpointListApiResponse = (): HostResultList => { - return mockHostResultList({ request_page_size: 1, request_page_index: 1, total: 10 }); + return mockEndpointResultList({ request_page_size: 1, request_page_index: 1, total: 10 }); }; - let historyPush: (params: HostIndexUIQueryParams) => void; + let historyPush: (params: EndpointIndexUIQueryParams) => void; beforeEach(() => { fakeCoreStart = coreMock.createStart(); depsStart = depsStartMock(); fakeHttpServices = fakeCoreStart.http as jest.Mocked; history = createBrowserHistory(); - const middleware = hostMiddlewareFactory(fakeCoreStart, depsStart); - ({ actionSpyMiddleware, waitForAction } = createSpyMiddleware()); - store = createStore(hostListReducer, applyMiddleware(middleware, actionSpyMiddleware)); + const middleware = endpointMiddlewareFactory(fakeCoreStart, depsStart); + ({ actionSpyMiddleware, waitForAction } = createSpyMiddleware()); + store = createStore(endpointListReducer, applyMiddleware(middleware, actionSpyMiddleware)); history.listen((location) => { store.dispatch({ type: 'userChangedUrl', payload: location }); @@ -55,12 +55,12 @@ describe('host list pagination: ', () => { queryParams = () => uiQueryParams(store.getState()); - historyPush = (nextQueryParams: HostIndexUIQueryParams): void => { - return history.push(getHostListPath({ name: 'hostList', ...nextQueryParams })); + historyPush = (nextQueryParams: EndpointIndexUIQueryParams): void => { + return history.push(getEndpointListPath({ name: 'endpointList', ...nextQueryParams })); }; }); - describe('when the user enteres the host list for the first time', () => { + describe('when the user enteres the endpoint list for the first time', () => { it('the api is called with page_index and page_size defaulting to 0 and 10 respectively', async () => { const apiResponse = getEndpointListApiResponse(); fakeHttpServices.post.mockResolvedValue(apiResponse); @@ -70,10 +70,10 @@ describe('host list pagination: ', () => { type: 'userChangedUrl', payload: { ...history.location, - pathname: getHostListPath({ name: 'hostList' }), + pathname: getEndpointListPath({ name: 'endpointList' }), }, }); - await waitForAction('serverReturnedHostList'); + await waitForAction('serverReturnedEndpointList'); expect(fakeHttpServices.post).toHaveBeenCalledWith('/api/endpoint/metadata', { body: JSON.stringify({ paging_properties: [{ page_index: '0' }, { page_size: '10' }], diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/index.test.ts b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/index.test.ts index 8ff4ad5a043b5f..b3ab3443809c8b 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/index.test.ts +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/index.test.ts @@ -5,24 +5,24 @@ */ import { createStore, Dispatch, Store } from 'redux'; -import { HostState } from '../types'; +import { EndpointState } from '../types'; import { listData } from './selectors'; -import { mockHostResultList } from './mock_host_result_list'; -import { HostAction } from './action'; -import { hostListReducer } from './reducer'; +import { mockEndpointResultList } from './mock_endpoint_result_list'; +import { EndpointAction } from './action'; +import { endpointListReducer } from './reducer'; -describe('HostList store concerns', () => { - let store: Store; - let dispatch: Dispatch; +describe('EndpointList store concerns', () => { + let store: Store; + let dispatch: Dispatch; const createTestStore = () => { - store = createStore(hostListReducer); + store = createStore(endpointListReducer); dispatch = store.dispatch; }; const loadDataToStore = () => { dispatch({ - type: 'serverReturnedHostList', - payload: mockHostResultList({ request_page_size: 1, request_page_index: 1, total: 10 }), + type: 'serverReturnedEndpointList', + payload: mockEndpointResultList({ request_page_size: 1, request_page_index: 1, total: 10 }), }); }; @@ -51,18 +51,18 @@ describe('HostList store concerns', () => { policyItemsLoading: false, endpointPackageInfo: undefined, nonExistingPolicies: {}, - hostsExist: true, + endpointsExist: true, }); }); - test('it handles `serverReturnedHostList', () => { - const payload = mockHostResultList({ + test('it handles `serverReturnedEndpointList', () => { + const payload = mockEndpointResultList({ request_page_size: 1, request_page_index: 1, total: 10, }); dispatch({ - type: 'serverReturnedHostList', + type: 'serverReturnedEndpointList', payload, }); @@ -80,7 +80,7 @@ describe('HostList store concerns', () => { loadDataToStore(); }); - test('it selects `hostListData`', () => { + test('it selects `endpointListData`', () => { const currentState = store.getState(); expect(listData(currentState)).toEqual(currentState.hosts); }); diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.test.ts b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.test.ts index 1c5c4fbac51bab..77ade5bcc69714 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.test.ts +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.test.ts @@ -16,36 +16,36 @@ import { } from '../../../../common/store/test_utils'; import { Immutable, HostResultList } from '../../../../../common/endpoint/types'; import { AppAction } from '../../../../common/store/actions'; -import { mockHostResultList } from './mock_host_result_list'; +import { mockEndpointResultList } from './mock_endpoint_result_list'; import { listData } from './selectors'; -import { HostState } from '../types'; -import { hostListReducer } from './reducer'; -import { hostMiddlewareFactory } from './middleware'; -import { getHostListPath } from '../../../common/routing'; +import { EndpointState } from '../types'; +import { endpointListReducer } from './reducer'; +import { endpointMiddlewareFactory } from './middleware'; +import { getEndpointListPath } from '../../../common/routing'; -describe('host list middleware', () => { +describe('endpoint list middleware', () => { let fakeCoreStart: jest.Mocked; let depsStart: DepsStartMock; let fakeHttpServices: jest.Mocked; - type HostListStore = Store, Immutable>; - let store: HostListStore; - let getState: HostListStore['getState']; - let dispatch: HostListStore['dispatch']; + type EndpointListStore = Store, Immutable>; + let store: EndpointListStore; + let getState: EndpointListStore['getState']; + let dispatch: EndpointListStore['dispatch']; let waitForAction: MiddlewareActionSpyHelper['waitForAction']; let actionSpyMiddleware; let history: History; const getEndpointListApiResponse = (): HostResultList => { - return mockHostResultList({ request_page_size: 1, request_page_index: 1, total: 10 }); + return mockEndpointResultList({ request_page_size: 1, request_page_index: 1, total: 10 }); }; beforeEach(() => { fakeCoreStart = coreMock.createStart({ basePath: '/mock' }); depsStart = depsStartMock(); fakeHttpServices = fakeCoreStart.http as jest.Mocked; - ({ actionSpyMiddleware, waitForAction } = createSpyMiddleware()); + ({ actionSpyMiddleware, waitForAction } = createSpyMiddleware()); store = createStore( - hostListReducer, - applyMiddleware(hostMiddlewareFactory(fakeCoreStart, depsStart), actionSpyMiddleware) + endpointListReducer, + applyMiddleware(endpointMiddlewareFactory(fakeCoreStart, depsStart), actionSpyMiddleware) ); getState = store.getState; dispatch = store.dispatch; @@ -60,10 +60,10 @@ describe('host list middleware', () => { type: 'userChangedUrl', payload: { ...history.location, - pathname: getHostListPath({ name: 'hostList' }), + pathname: getEndpointListPath({ name: 'endpointList' }), }, }); - await waitForAction('serverReturnedHostList'); + await waitForAction('serverReturnedEndpointList'); expect(fakeHttpServices.post).toHaveBeenCalledWith('/api/endpoint/metadata', { body: JSON.stringify({ paging_properties: [{ page_index: '0' }, { page_size: '10' }], diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.ts b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.ts index 74bebf211258ae..fa2dbe084c1a42 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.ts +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.ts @@ -9,14 +9,14 @@ import { HostInfo, HostResultList } from '../../../../../common/endpoint/types'; import { GetPolicyListResponse } from '../../policy/types'; import { ImmutableMiddlewareFactory } from '../../../../common/store'; import { - isOnHostPage, - hasSelectedHost, + isOnEndpointPage, + hasSelectedEndpoint, uiQueryParams, listData, endpointPackageInfo, nonExistingPolicies, } from './selectors'; -import { HostState } from '../types'; +import { EndpointState } from '../types'; import { sendGetEndpointSpecificPackageConfigs, sendGetEndpointSecurityPackage, @@ -24,16 +24,16 @@ import { } from '../../policy/store/policy_list/services/ingest'; import { AGENT_CONFIG_SAVED_OBJECT_TYPE } from '../../../../../../ingest_manager/common'; -export const hostMiddlewareFactory: ImmutableMiddlewareFactory = (coreStart) => { +export const endpointMiddlewareFactory: ImmutableMiddlewareFactory = (coreStart) => { return ({ getState, dispatch }) => (next) => async (action) => { next(action); const state = getState(); - // Host list + // Endpoint list if ( action.type === 'userChangedUrl' && - isOnHostPage(state) && - hasSelectedHost(state) !== true + isOnEndpointPage(state) && + hasSelectedEndpoint(state) !== true ) { if (!endpointPackageInfo(state)) { sendGetEndpointSecurityPackage(coreStart.http) @@ -50,30 +50,30 @@ export const hostMiddlewareFactory: ImmutableMiddlewareFactory = (cor } const { page_index: pageIndex, page_size: pageSize } = uiQueryParams(state); - let hostResponse; + let endpointResponse; try { - hostResponse = await coreStart.http.post('/api/endpoint/metadata', { + endpointResponse = await coreStart.http.post('/api/endpoint/metadata', { body: JSON.stringify({ paging_properties: [{ page_index: pageIndex }, { page_size: pageSize }], }), }); - hostResponse.request_page_index = Number(pageIndex); + endpointResponse.request_page_index = Number(pageIndex); dispatch({ - type: 'serverReturnedHostList', - payload: hostResponse, + type: 'serverReturnedEndpointList', + payload: endpointResponse, }); - getNonExistingPoliciesForHostsList( + getNonExistingPoliciesForEndpointsList( coreStart.http, - hostResponse.hosts, + endpointResponse.hosts, nonExistingPolicies(state) ) .then((missingPolicies) => { if (missingPolicies !== undefined) { dispatch({ - type: 'serverReturnedHostNonExistingPolicies', + type: 'serverReturnedEndpointNonExistingPolicies', payload: missingPolicies, }); } @@ -83,24 +83,24 @@ export const hostMiddlewareFactory: ImmutableMiddlewareFactory = (cor .catch((error) => console.error(error)); } catch (error) { dispatch({ - type: 'serverFailedToReturnHostList', + type: 'serverFailedToReturnEndpointList', payload: error, }); } - // No hosts, so we should check to see if there are policies for onboarding - if (hostResponse && hostResponse.hosts.length === 0) { + // No endpoints, so we should check to see if there are policies for onboarding + if (endpointResponse && endpointResponse.hosts.length === 0) { const http = coreStart.http; // The original query to the list could have had an invalid param (ex. invalid page_size), - // so we check first if hosts actually do exist before pulling in data for the onboarding + // so we check first if endpoints actually do exist before pulling in data for the onboarding // messages. - if (await doHostsExist(http)) { + if (await doEndpointsExist(http)) { return; } dispatch({ - type: 'serverReturnedHostExistValue', + type: 'serverReturnedEndpointExistValue', payload: false, }); @@ -135,13 +135,13 @@ export const hostMiddlewareFactory: ImmutableMiddlewareFactory = (cor } } - // Host Details - if (action.type === 'userChangedUrl' && hasSelectedHost(state) === true) { + // Endpoint Details + if (action.type === 'userChangedUrl' && hasSelectedEndpoint(state) === true) { dispatch({ type: 'serverCancelledPolicyItemsLoading', }); - // If user navigated directly to a host details page, load the host list + // If user navigated directly to a endpoint details page, load the endpoint list if (listData(state).length === 0) { const { page_index: pageIndex, page_size: pageSize } = uiQueryParams(state); try { @@ -152,11 +152,11 @@ export const hostMiddlewareFactory: ImmutableMiddlewareFactory = (cor }); response.request_page_index = Number(pageIndex); dispatch({ - type: 'serverReturnedHostList', + type: 'serverReturnedEndpointList', payload: response, }); - getNonExistingPoliciesForHostsList( + getNonExistingPoliciesForEndpointsList( coreStart.http, response.hosts, nonExistingPolicies(state) @@ -164,7 +164,7 @@ export const hostMiddlewareFactory: ImmutableMiddlewareFactory = (cor .then((missingPolicies) => { if (missingPolicies !== undefined) { dispatch({ - type: 'serverReturnedHostNonExistingPolicies', + type: 'serverReturnedEndpointNonExistingPolicies', payload: missingPolicies, }); } @@ -174,31 +174,35 @@ export const hostMiddlewareFactory: ImmutableMiddlewareFactory = (cor .catch((error) => console.error(error)); } catch (error) { dispatch({ - type: 'serverFailedToReturnHostList', + type: 'serverFailedToReturnEndpointList', payload: error, }); } } else { dispatch({ - type: 'serverCancelledHostListLoading', + type: 'serverCancelledEndpointListLoading', }); } - // call the host details api - const { selected_host: selectedHost } = uiQueryParams(state); + // call the endpoint details api + const { selected_endpoint: selectedEndpoint } = uiQueryParams(state); try { const response = await coreStart.http.get( - `/api/endpoint/metadata/${selectedHost}` + `/api/endpoint/metadata/${selectedEndpoint}` ); dispatch({ - type: 'serverReturnedHostDetails', + type: 'serverReturnedEndpointDetails', payload: response, }); - getNonExistingPoliciesForHostsList(coreStart.http, [response], nonExistingPolicies(state)) + getNonExistingPoliciesForEndpointsList( + coreStart.http, + [response], + nonExistingPolicies(state) + ) .then((missingPolicies) => { if (missingPolicies !== undefined) { dispatch({ - type: 'serverReturnedHostNonExistingPolicies', + type: 'serverReturnedEndpointNonExistingPolicies', payload: missingPolicies, }); } @@ -208,7 +212,7 @@ export const hostMiddlewareFactory: ImmutableMiddlewareFactory = (cor .catch((error) => console.error(error)); } catch (error) { dispatch({ - type: 'serverFailedToReturnHostDetails', + type: 'serverFailedToReturnEndpointDetails', payload: error, }); } @@ -216,15 +220,15 @@ export const hostMiddlewareFactory: ImmutableMiddlewareFactory = (cor // call the policy response api try { const policyResponse = await coreStart.http.get(`/api/endpoint/policy_response`, { - query: { hostId: selectedHost }, + query: { hostId: selectedEndpoint }, }); dispatch({ - type: 'serverReturnedHostPolicyResponse', + type: 'serverReturnedEndpointPolicyResponse', payload: policyResponse, }); } catch (error) { dispatch({ - type: 'serverFailedToReturnHostPolicyResponse', + type: 'serverFailedToReturnEndpointPolicyResponse', payload: error, }); } @@ -232,11 +236,11 @@ export const hostMiddlewareFactory: ImmutableMiddlewareFactory = (cor }; }; -const getNonExistingPoliciesForHostsList = async ( +const getNonExistingPoliciesForEndpointsList = async ( http: HttpStart, hosts: HostResultList['hosts'], - currentNonExistingPolicies: HostState['nonExistingPolicies'] -): Promise => { + currentNonExistingPolicies: EndpointState['nonExistingPolicies'] +): Promise => { if (hosts.length === 0) { return; } @@ -266,14 +270,14 @@ const getNonExistingPoliciesForHostsList = async ( )})`, }, }) - ).items.reduce((list, agentConfig) => { + ).items.reduce((list, agentConfig) => { (agentConfig.package_configs as string[]).forEach((packageConfig) => { list[packageConfig as string] = true; }); return list; }, {}); - const nonExisting = policyIdsToCheck.reduce( + const nonExisting = policyIdsToCheck.reduce( (list, policyId) => { if (policiesFound[policyId]) { return list; @@ -291,7 +295,7 @@ const getNonExistingPoliciesForHostsList = async ( return nonExisting; }; -const doHostsExist = async (http: HttpStart): Promise => { +const doEndpointsExist = async (http: HttpStart): Promise => { try { return ( ( @@ -304,7 +308,7 @@ const doHostsExist = async (http: HttpStart): Promise => { ); } catch (error) { // eslint-disable-next-line no-console - console.error(`error while trying to check if hosts exist`); + console.error(`error while trying to check if endpoints exist`); // eslint-disable-next-line no-console console.error(error); } diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/mock_host_result_list.ts b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/mock_endpoint_result_list.ts similarity index 79% rename from x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/mock_host_result_list.ts rename to x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/mock_endpoint_result_list.ts index b69e5c5cd0e65c..2f0b66624f379e 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/mock_host_result_list.ts +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/mock_endpoint_result_list.ts @@ -26,7 +26,7 @@ import { GetPolicyListResponse } from '../../policy/types'; const generator = new EndpointDocGenerator('seed'); -export const mockHostResultList: (options?: { +export const mockEndpointResultList: (options?: { total?: number; request_page_size?: number; request_page_index?: number; @@ -62,7 +62,7 @@ export const mockHostResultList: (options?: { /** * returns a mocked API response for retrieving a single host metadata */ -export const mockHostDetailsApiResult = (): HostInfo => { +export const mockEndpointDetailsApiResult = (): HostInfo => { return { metadata: generator.generateHostMetadata(), host_status: HostStatus.ERROR, @@ -73,14 +73,14 @@ export const mockHostDetailsApiResult = (): HostInfo => { * Mock API handlers used by the Endpoint Host list. It also sets up a list of * API handlers for Host details based on a list of Host results. */ -const hostListApiPathHandlerMocks = ({ - hostsResults = mockHostResultList({ total: 3 }).hosts, +const endpointListApiPathHandlerMocks = ({ + endpointsResults = mockEndpointResultList({ total: 3 }).hosts, epmPackages = [generator.generateEpmPackage()], endpointPackageConfigs = [], policyResponse = generator.generatePolicyResponse(), }: { /** route handlers will be setup for each individual host in this array */ - hostsResults?: HostResultList['hosts']; + endpointsResults?: HostResultList['hosts']; epmPackages?: GetPackagesResponse['response']; endpointPackageConfigs?: GetPolicyListResponse['items']; policyResponse?: HostPolicyResponse; @@ -94,17 +94,17 @@ const hostListApiPathHandlerMocks = ({ }; }, - // host list + // endpoint list '/api/endpoint/metadata': (): HostResultList => { return { - hosts: hostsResults, + hosts: endpointsResults, request_page_size: 10, request_page_index: 0, - total: hostsResults?.length || 0, + total: endpointsResults?.length || 0, }; }, - // Do policies referenced in host list exist + // Do policies referenced in endpoint list exist // just returns 1 single agent config that includes all of the packageConfig IDs provided [INGEST_API_AGENT_CONFIGS]: (): GetAgentConfigsResponse => { const agentConfig = generator.generateAgentConfig(); @@ -137,9 +137,9 @@ const hostListApiPathHandlerMocks = ({ }, }; - // Build a GET route handler for each host details based on the list of Hosts passed on input - if (hostsResults) { - hostsResults.forEach((host) => { + // Build a GET route handler for each endpoint details based on the list of Endpoints passed on input + if (endpointsResults) { + endpointsResults.forEach((host) => { // @ts-expect-error apiHandlers[`/api/endpoint/metadata/${host.metadata.host.id}`] = () => host; }); @@ -149,33 +149,36 @@ const hostListApiPathHandlerMocks = ({ }; /** - * Sets up mock impelementations in support of the Hosts list view + * Sets up mock impelementations in support of the Endpoints list view * * @param mockedHttpService - * @param hostsResults + * @param endpointsResults * @param pathHandlersOptions */ -export const setHostListApiMockImplementation: ( +export const setEndpointListApiMockImplementation: ( mockedHttpService: jest.Mocked, - apiResponses?: Parameters[0] + apiResponses?: Parameters[0] ) => void = ( mockedHttpService, - { hostsResults = mockHostResultList({ total: 3 }).hosts, ...pathHandlersOptions } = {} + { endpointsResults = mockEndpointResultList({ total: 3 }).hosts, ...pathHandlersOptions } = {} ) => { - const apiHandlers = hostListApiPathHandlerMocks({ ...pathHandlersOptions, hostsResults }); + const apiHandlers = endpointListApiPathHandlerMocks({ + ...pathHandlersOptions, + endpointsResults, + }); mockedHttpService.post .mockImplementation(async (...args) => { throw new Error(`un-expected call to http.post: ${args}`); }) - // First time called, return list of hosts + // First time called, return list of endpoints .mockImplementationOnce(async () => { return apiHandlers['/api/endpoint/metadata'](); }); - // If the hosts list results is zero, then mock the second call to `/metadata` to return - // empty list - indicating there are no hosts currently present on the system - if (!hostsResults.length) { + // If the endpoints list results is zero, then mock the second call to `/metadata` to return + // empty list - indicating there are no endpoints currently present on the system + if (!endpointsResults.length) { mockedHttpService.post.mockImplementationOnce(async () => { return apiHandlers['/api/endpoint/metadata'](); }); diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/reducer.ts b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/reducer.ts index e54f7df4d4f75a..d4fe3310eac0aa 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/reducer.ts +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/reducer.ts @@ -4,13 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ -import { isOnHostPage, hasSelectedHost } from './selectors'; -import { HostState } from '../types'; +import { isOnEndpointPage, hasSelectedEndpoint } from './selectors'; +import { EndpointState } from '../types'; import { AppAction } from '../../../../common/store/actions'; import { ImmutableReducer } from '../../../../common/store'; import { Immutable } from '../../../../../common/endpoint/types'; -export const initialHostListState: Immutable = { +export const initialEndpointListState: Immutable = { hosts: [], pageSize: 10, pageIndex: 0, @@ -29,15 +29,15 @@ export const initialHostListState: Immutable = { policyItemsLoading: false, endpointPackageInfo: undefined, nonExistingPolicies: {}, - hostsExist: true, + endpointsExist: true, }; /* eslint-disable-next-line complexity */ -export const hostListReducer: ImmutableReducer = ( - state = initialHostListState, +export const endpointListReducer: ImmutableReducer = ( + state = initialEndpointListState, action ) => { - if (action.type === 'serverReturnedHostList') { + if (action.type === 'serverReturnedEndpointList') { const { hosts, total, @@ -53,13 +53,13 @@ export const hostListReducer: ImmutableReducer = ( loading: false, error: undefined, }; - } else if (action.type === 'serverFailedToReturnHostList') { + } else if (action.type === 'serverFailedToReturnEndpointList') { return { ...state, error: action.payload, loading: false, }; - } else if (action.type === 'serverReturnedHostNonExistingPolicies') { + } else if (action.type === 'serverReturnedEndpointNonExistingPolicies') { return { ...state, nonExistingPolicies: { @@ -67,14 +67,14 @@ export const hostListReducer: ImmutableReducer = ( ...action.payload, }, }; - } else if (action.type === 'serverReturnedHostDetails') { + } else if (action.type === 'serverReturnedEndpointDetails') { return { ...state, details: action.payload.metadata, detailsLoading: false, detailsError: undefined, }; - } else if (action.type === 'serverFailedToReturnHostDetails') { + } else if (action.type === 'serverFailedToReturnEndpointDetails') { return { ...state, detailsError: action.payload, @@ -92,14 +92,14 @@ export const hostListReducer: ImmutableReducer = ( error: action.payload, policyItemsLoading: false, }; - } else if (action.type === 'serverReturnedHostPolicyResponse') { + } else if (action.type === 'serverReturnedEndpointPolicyResponse') { return { ...state, policyResponse: action.payload.policy_response, policyResponseLoading: false, policyResponseError: undefined, }; - } else if (action.type === 'serverFailedToReturnHostPolicyResponse') { + } else if (action.type === 'serverFailedToReturnEndpointPolicyResponse') { return { ...state, policyResponseError: action.payload, @@ -111,7 +111,7 @@ export const hostListReducer: ImmutableReducer = ( selectedPolicyId: action.payload.selectedPolicyId, policyResponseLoading: false, }; - } else if (action.type === 'serverCancelledHostListLoading') { + } else if (action.type === 'serverCancelledEndpointListLoading') { return { ...state, loading: false, @@ -126,22 +126,22 @@ export const hostListReducer: ImmutableReducer = ( ...state, endpointPackageInfo: action.payload, }; - } else if (action.type === 'serverReturnedHostExistValue') { + } else if (action.type === 'serverReturnedEndpointExistValue') { return { ...state, - hostsExist: action.payload, + endpointsExist: action.payload, }; } else if (action.type === 'userChangedUrl') { - const newState: Immutable = { + const newState: Immutable = { ...state, location: action.payload, }; - const isCurrentlyOnListPage = isOnHostPage(newState) && !hasSelectedHost(newState); - const wasPreviouslyOnListPage = isOnHostPage(state) && !hasSelectedHost(state); - const isCurrentlyOnDetailsPage = isOnHostPage(newState) && hasSelectedHost(newState); - const wasPreviouslyOnDetailsPage = isOnHostPage(state) && hasSelectedHost(state); + const isCurrentlyOnListPage = isOnEndpointPage(newState) && !hasSelectedEndpoint(newState); + const wasPreviouslyOnListPage = isOnEndpointPage(state) && !hasSelectedEndpoint(state); + const isCurrentlyOnDetailsPage = isOnEndpointPage(newState) && hasSelectedEndpoint(newState); + const wasPreviouslyOnDetailsPage = isOnEndpointPage(state) && hasSelectedEndpoint(state); - // if on the host list page for the first time, return new location and load list + // if on the endpoint list page for the first time, return new location and load list if (isCurrentlyOnListPage) { if (!wasPreviouslyOnListPage) { return { @@ -154,7 +154,7 @@ export const hostListReducer: ImmutableReducer = ( }; } } else if (isCurrentlyOnDetailsPage) { - // if previous page was the list or another host details page, load host details only + // if previous page was the list or another endpoint details page, load endpoint details only if (wasPreviouslyOnDetailsPage || wasPreviouslyOnListPage) { return { ...state, @@ -166,7 +166,7 @@ export const hostListReducer: ImmutableReducer = ( policyResponseError: undefined, }; } else { - // if previous page was not host list or host details, load both list and details + // if previous page was not endpoint list or endpoint details, load both list and details return { ...state, location: action.payload, @@ -180,14 +180,14 @@ export const hostListReducer: ImmutableReducer = ( }; } } - // otherwise we are not on a host list or details page + // otherwise we are not on a endpoint list or details page return { ...state, location: action.payload, error: undefined, detailsError: undefined, policyResponseError: undefined, - hostsExist: true, + endpointsExist: true, }; } return state; diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/selectors.ts b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/selectors.ts index ca006f21c29ac2..2c6fc6d5a75e19 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/selectors.ts +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/selectors.ts @@ -14,36 +14,36 @@ import { HostPolicyResponseConfiguration, HostPolicyResponseActionStatus, } from '../../../../../common/endpoint/types'; -import { HostState, HostIndexUIQueryParams } from '../types'; -import { MANAGEMENT_ROUTING_HOSTS_PATH } from '../../../common/constants'; +import { EndpointState, EndpointIndexUIQueryParams } from '../types'; +import { MANAGEMENT_ROUTING_ENDPOINTS_PATH } from '../../../common/constants'; const PAGE_SIZES = Object.freeze([10, 20, 50]); -export const listData = (state: Immutable) => state.hosts; +export const listData = (state: Immutable) => state.hosts; -export const pageIndex = (state: Immutable): number => state.pageIndex; +export const pageIndex = (state: Immutable): number => state.pageIndex; -export const pageSize = (state: Immutable): number => state.pageSize; +export const pageSize = (state: Immutable): number => state.pageSize; -export const totalHits = (state: Immutable): number => state.total; +export const totalHits = (state: Immutable): number => state.total; -export const listLoading = (state: Immutable): boolean => state.loading; +export const listLoading = (state: Immutable): boolean => state.loading; -export const listError = (state: Immutable) => state.error; +export const listError = (state: Immutable) => state.error; -export const detailsData = (state: Immutable) => state.details; +export const detailsData = (state: Immutable) => state.details; -export const detailsLoading = (state: Immutable): boolean => state.detailsLoading; +export const detailsLoading = (state: Immutable): boolean => state.detailsLoading; -export const detailsError = (state: Immutable) => state.detailsError; +export const detailsError = (state: Immutable) => state.detailsError; -export const policyItems = (state: Immutable) => state.policyItems; +export const policyItems = (state: Immutable) => state.policyItems; -export const policyItemsLoading = (state: Immutable) => state.policyItemsLoading; +export const policyItemsLoading = (state: Immutable) => state.policyItemsLoading; -export const selectedPolicyId = (state: Immutable) => state.selectedPolicyId; +export const selectedPolicyId = (state: Immutable) => state.selectedPolicyId; -export const endpointPackageInfo = (state: Immutable) => state.endpointPackageInfo; +export const endpointPackageInfo = (state: Immutable) => state.endpointPackageInfo; export const endpointPackageVersion = createSelector( endpointPackageInfo, @@ -53,14 +53,14 @@ export const endpointPackageVersion = createSelector( /** * Returns the full policy response from the endpoint after a user modifies a policy. */ -const detailsPolicyAppliedResponse = (state: Immutable) => +const detailsPolicyAppliedResponse = (state: Immutable) => state.policyResponse && state.policyResponse.Endpoint.policy.applied; /** * Returns the response configurations from the endpoint after a user modifies a policy. */ export const policyResponseConfigurations: ( - state: Immutable + state: Immutable ) => undefined | Immutable = createSelector( detailsPolicyAppliedResponse, (applied) => { @@ -72,7 +72,7 @@ export const policyResponseConfigurations: ( * Returns a map of the number of failed and warning policy response actions per configuration. */ export const policyResponseFailedOrWarningActionCount: ( - state: Immutable + state: Immutable ) => Map = createSelector(detailsPolicyAppliedResponse, (applied) => { const failureOrWarningByConfigType = new Map(); if (applied?.response?.configurations !== undefined && applied?.actions !== undefined) { @@ -98,7 +98,7 @@ export const policyResponseFailedOrWarningActionCount: ( * Returns the actions taken by the endpoint for each response configuration after a user modifies a policy. */ export const policyResponseActions: ( - state: Immutable + state: Immutable ) => undefined | Immutable = createSelector( detailsPolicyAppliedResponse, (applied) => { @@ -106,32 +106,32 @@ export const policyResponseActions: ( } ); -export const policyResponseLoading = (state: Immutable): boolean => +export const policyResponseLoading = (state: Immutable): boolean => state.policyResponseLoading; -export const policyResponseError = (state: Immutable) => state.policyResponseError; +export const policyResponseError = (state: Immutable) => state.policyResponseError; -export const isOnHostPage = (state: Immutable) => { +export const isOnEndpointPage = (state: Immutable) => { return ( matchPath(state.location?.pathname ?? '', { - path: MANAGEMENT_ROUTING_HOSTS_PATH, + path: MANAGEMENT_ROUTING_ENDPOINTS_PATH, exact: true, }) !== null ); }; export const uiQueryParams: ( - state: Immutable -) => Immutable = createSelector( - (state: Immutable) => state.location, - (location: Immutable['location']) => { - const data: HostIndexUIQueryParams = { page_index: '0', page_size: '10' }; + state: Immutable +) => Immutable = createSelector( + (state: Immutable) => state.location, + (location: Immutable['location']) => { + const data: EndpointIndexUIQueryParams = { page_index: '0', page_size: '10' }; if (location) { // Removes the `?` from the beginning of query string if it exists const query = querystring.parse(location.search.slice(1)); - const keys: Array = [ - 'selected_host', + const keys: Array = [ + 'selected_endpoint', 'page_size', 'page_index', 'show', @@ -171,15 +171,15 @@ export const uiQueryParams: ( } ); -export const hasSelectedHost: (state: Immutable) => boolean = createSelector( +export const hasSelectedEndpoint: (state: Immutable) => boolean = createSelector( uiQueryParams, - ({ selected_host: selectedHost }) => { - return selectedHost !== undefined; + ({ selected_endpoint: selectedEndpoint }) => { + return selectedEndpoint !== undefined; } ); /** What policy details panel view to show */ -export const showView: (state: HostState) => 'policy_response' | 'details' = createSelector( +export const showView: (state: EndpointState) => 'policy_response' | 'details' = createSelector( uiQueryParams, (searchParams) => { return searchParams.show === 'policy_response' ? 'policy_response' : 'details'; @@ -189,7 +189,7 @@ export const showView: (state: HostState) => 'policy_response' | 'details' = cre /** * Returns the Policy Response overall status */ -export const policyResponseStatus: (state: Immutable) => string = createSelector( +export const policyResponseStatus: (state: Immutable) => string = createSelector( (state) => state.policyResponse, (policyResponse) => { return (policyResponse && policyResponse?.Endpoint?.policy?.applied?.status) || ''; @@ -197,15 +197,16 @@ export const policyResponseStatus: (state: Immutable) => string = cre ); /** - * returns the list of known non-existing polices that may have been in the Host API response. + * returns the list of known non-existing polices that may have been in the Endpoint API response. * @param state */ export const nonExistingPolicies: ( - state: Immutable -) => Immutable = (state) => state.nonExistingPolicies; + state: Immutable +) => Immutable = (state) => state.nonExistingPolicies; /** - * Return boolean that indicates whether hosts exist + * Return boolean that indicates whether endpoints exist * @param state */ -export const hostsExist: (state: Immutable) => boolean = (state) => state.hostsExist; +export const endpointsExist: (state: Immutable) => boolean = (state) => + state.endpointsExist; diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/types.ts b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/types.ts index 6c949e9700b9a0..7e75285560bd3e 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/types.ts +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/types.ts @@ -15,7 +15,7 @@ import { import { ServerApiError } from '../../../common/types'; import { GetPackagesResponse } from '../../../../../ingest_manager/common'; -export interface HostState { +export interface EndpointState { /** list of host **/ hosts: HostInfo[]; /** number of items per page */ @@ -53,15 +53,15 @@ export interface HostState { /** tracks the list of policies IDs used in Host metadata that may no longer exist */ nonExistingPolicies: Record; /** Tracks whether hosts exist and helps control if onboarding should be visible */ - hostsExist: boolean; + endpointsExist: boolean; } /** * Query params on the host page parsed from the URL */ -export interface HostIndexUIQueryParams { - /** Selected host id shows host details flyout */ - selected_host?: string; +export interface EndpointIndexUIQueryParams { + /** Selected endpoint id shows host details flyout */ + selected_endpoint?: string; /** How many items to show in list */ page_size?: string; /** Which page to show */ diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/components/host_policy_link.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/components/endpoint_policy_link.tsx similarity index 89% rename from x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/components/host_policy_link.tsx rename to x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/components/endpoint_policy_link.tsx index ec4d7e87b721dc..2b6132aca41089 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/components/host_policy_link.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/components/endpoint_policy_link.tsx @@ -6,7 +6,7 @@ import React, { memo, useMemo } from 'react'; import { EuiLink, EuiLinkAnchorProps } from '@elastic/eui'; -import { useHostSelector } from '../hooks'; +import { useEndpointSelector } from '../hooks'; import { nonExistingPolicies } from '../../store/selectors'; import { getPolicyDetailPath } from '../../../../common/routing'; import { useFormatUrl } from '../../../../../common/components/link_to'; @@ -18,12 +18,12 @@ import { useNavigateByRouterEventHandler } from '../../../../../common/hooks/end * the `nonExistingPolicies` value in the store. If it does not exist, then regular * text is returned. */ -export const HostPolicyLink = memo< +export const EndpointPolicyLink = memo< Omit & { policyId: string; } >(({ policyId, children, onClick, ...otherProps }) => { - const missingPolicies = useHostSelector(nonExistingPolicies); + const missingPolicies = useEndpointSelector(nonExistingPolicies); const { formatUrl } = useFormatUrl(SecurityPageName.administration); const { toRoutePath, toRouteUrl } = useMemo(() => { const toPath = getPolicyDetailPath(policyId); @@ -50,4 +50,4 @@ export const HostPolicyLink = memo< ); }); -HostPolicyLink.displayName = 'HostPolicyLink'; +EndpointPolicyLink.displayName = 'EndpointPolicyLink'; diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/host_details.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/endpoint_details.tsx similarity index 76% rename from x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/host_details.tsx rename to x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/endpoint_details.tsx index 6a0a0cbb1014ee..bd499ee6abb245 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/host_details.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/endpoint_details.tsx @@ -19,18 +19,18 @@ import React, { memo, useMemo } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; import { HostMetadata } from '../../../../../../common/endpoint/types'; -import { useHostSelector, useAgentDetailsIngestUrl } from '../hooks'; +import { useEndpointSelector, useAgentDetailsIngestUrl } from '../hooks'; import { useNavigateToAppEventHandler } from '../../../../../common/hooks/endpoint/use_navigate_to_app_event_handler'; import { policyResponseStatus, uiQueryParams } from '../../store/selectors'; import { POLICY_STATUS_TO_HEALTH_COLOR } from '../host_constants'; import { FormattedDateAndTime } from '../../../../../common/components/endpoint/formatted_date_time'; import { useNavigateByRouterEventHandler } from '../../../../../common/hooks/endpoint/use_navigate_by_router_event_handler'; import { LinkToApp } from '../../../../../common/components/endpoint/link_to_app'; -import { getHostDetailsPath } from '../../../../common/routing'; +import { getEndpointDetailsPath } from '../../../../common/routing'; import { SecurityPageName } from '../../../../../app/types'; import { useFormatUrl } from '../../../../../common/components/link_to'; import { AgentDetailsReassignConfigAction } from '../../../../../../../ingest_manager/public'; -import { HostPolicyLink } from '../components/host_policy_link'; +import { EndpointPolicyLink } from '../components/endpoint_policy_link'; const HostIds = styled(EuiListGroupItem)` margin-top: 0; @@ -51,15 +51,15 @@ const LinkToExternalApp = styled.div` const openReassignFlyoutSearch = '?openReassignFlyout=true'; -export const HostDetails = memo(({ details }: { details: HostMetadata }) => { +export const EndpointDetails = memo(({ details }: { details: HostMetadata }) => { const agentId = details.elastic.agent.id; const { url: agentDetailsUrl, appId: ingestAppId, appPath: agentDetailsAppPath, } = useAgentDetailsIngestUrl(agentId); - const queryParams = useHostSelector(uiQueryParams); - const policyStatus = useHostSelector( + const queryParams = useEndpointSelector(uiQueryParams); + const policyStatus = useEndpointSelector( policyResponseStatus ) as keyof typeof POLICY_STATUS_TO_HEALTH_COLOR; const { formatUrl } = useFormatUrl(SecurityPageName.administration); @@ -67,13 +67,13 @@ export const HostDetails = memo(({ details }: { details: HostMetadata }) => { const detailsResultsUpper = useMemo(() => { return [ { - title: i18n.translate('xpack.securitySolution.endpoint.host.details.os', { + title: i18n.translate('xpack.securitySolution.endpoint.details.os', { defaultMessage: 'OS', }), description: details.host.os.full, }, { - title: i18n.translate('xpack.securitySolution.endpoint.host.details.lastSeen', { + title: i18n.translate('xpack.securitySolution.endpoint.details.lastSeen', { defaultMessage: 'Last Seen', }), description: , @@ -83,19 +83,19 @@ export const HostDetails = memo(({ details }: { details: HostMetadata }) => { const [policyResponseUri, policyResponseRoutePath] = useMemo(() => { // eslint-disable-next-line @typescript-eslint/naming-convention - const { selected_host, show, ...currentUrlParams } = queryParams; + const { selected_endpoint, show, ...currentUrlParams } = queryParams; return [ formatUrl( - getHostDetailsPath({ - name: 'hostPolicyResponse', + getEndpointDetailsPath({ + name: 'endpointPolicyResponse', ...currentUrlParams, - selected_host: details.host.id, + selected_endpoint: details.host.id, }) ), - getHostDetailsPath({ - name: 'hostPolicyResponse', + getEndpointDetailsPath({ + name: 'endpointPolicyResponse', ...currentUrlParams, - selected_host: details.host.id, + selected_endpoint: details.host.id, }), ]; }, [details.host.id, formatUrl, queryParams]); @@ -110,7 +110,10 @@ export const HostDetails = memo(({ details }: { details: HostMetadata }) => { onDoneNavigateTo: [ 'securitySolution:administration', { - path: getHostDetailsPath({ name: 'hostDetails', selected_host: details.host.id }), + path: getEndpointDetailsPath({ + name: 'endpointDetails', + selected_endpoint: details.host.id, + }), }, ], }, @@ -121,22 +124,22 @@ export const HostDetails = memo(({ details }: { details: HostMetadata }) => { const detailsResultsPolicy = useMemo(() => { return [ { - title: i18n.translate('xpack.securitySolution.endpoint.host.details.policy', { + title: i18n.translate('xpack.securitySolution.endpoint.details.policy', { defaultMessage: 'Integration', }), description: ( <> - {details.Endpoint.policy.applied.name} - + ), }, { - title: i18n.translate('xpack.securitySolution.endpoint.host.details.policyStatus', { + title: i18n.translate('xpack.securitySolution.endpoint.details.policyStatus', { defaultMessage: 'Configuration response', }), description: ( @@ -152,7 +155,7 @@ export const HostDetails = memo(({ details }: { details: HostMetadata }) => { > @@ -166,7 +169,7 @@ export const HostDetails = memo(({ details }: { details: HostMetadata }) => { const detailsResultsLower = useMemo(() => { return [ { - title: i18n.translate('xpack.securitySolution.endpoint.host.details.ipAddress', { + title: i18n.translate('xpack.securitySolution.endpoint.details.ipAddress', { defaultMessage: 'IP Address', }), description: ( @@ -178,13 +181,13 @@ export const HostDetails = memo(({ details }: { details: HostMetadata }) => { ), }, { - title: i18n.translate('xpack.securitySolution.endpoint.host.details.hostname', { + title: i18n.translate('xpack.securitySolution.endpoint.details.hostname', { defaultMessage: 'Hostname', }), description: details.host.hostname, }, { - title: i18n.translate('xpack.securitySolution.endpoint.host.details.endpointVersion', { + title: i18n.translate('xpack.securitySolution.endpoint.details.endpointVersion', { defaultMessage: 'Endpoint Version', }), description: details.agent.version, @@ -197,13 +200,13 @@ export const HostDetails = memo(({ details }: { details: HostMetadata }) => { { appPath={agentDetailsWithFlyoutPath} href={agentDetailsWithFlyoutUrl} onClick={handleReassignEndpointsClick} - data-test-subj="hostDetailsLinkToIngest" + data-test-subj="endpointDetailsLinkToIngest" > @@ -225,10 +228,10 @@ export const HostDetails = memo(({ details }: { details: HostMetadata }) => { ); }); -HostDetails.displayName = 'HostDetails'; +EndpointDetails.displayName = 'EndpointDetails'; diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/index.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/index.tsx index 69dabeeb616a0e..40227ec24a9e44 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/index.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/index.tsx @@ -19,7 +19,7 @@ import { useHistory } from 'react-router-dom'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; import { useToasts } from '../../../../../common/lib/kibana'; -import { useHostSelector } from '../hooks'; +import { useEndpointSelector } from '../hooks'; import { urlFromQueryParams } from '../url_from_query_params'; import { uiQueryParams, @@ -33,36 +33,39 @@ import { policyResponseError, policyResponseLoading, } from '../../store/selectors'; -import { HostDetails } from './host_details'; +import { EndpointDetails } from './endpoint_details'; import { PolicyResponse } from './policy_response'; import { HostMetadata } from '../../../../../../common/endpoint/types'; import { FlyoutSubHeader, FlyoutSubHeaderProps } from './components/flyout_sub_header'; import { useNavigateByRouterEventHandler } from '../../../../../common/hooks/endpoint/use_navigate_by_router_event_handler'; -import { getHostListPath } from '../../../../common/routing'; +import { getEndpointListPath } from '../../../../common/routing'; import { SecurityPageName } from '../../../../../app/types'; import { useFormatUrl } from '../../../../../common/components/link_to'; -export const HostDetailsFlyout = memo(() => { +export const EndpointDetailsFlyout = memo(() => { const history = useHistory(); const toasts = useToasts(); - const queryParams = useHostSelector(uiQueryParams); - const { selected_host: selectedHost, ...queryParamsWithoutSelectedHost } = queryParams; - const details = useHostSelector(detailsData); - const loading = useHostSelector(detailsLoading); - const error = useHostSelector(detailsError); - const show = useHostSelector(showView); + const queryParams = useEndpointSelector(uiQueryParams); + const { + selected_endpoint: selectedEndpoint, + ...queryParamsWithoutSelectedEndpoint + } = queryParams; + const details = useEndpointSelector(detailsData); + const loading = useEndpointSelector(detailsLoading); + const error = useEndpointSelector(detailsError); + const show = useEndpointSelector(showView); const handleFlyoutClose = useCallback(() => { - history.push(urlFromQueryParams(queryParamsWithoutSelectedHost)); - }, [history, queryParamsWithoutSelectedHost]); + history.push(urlFromQueryParams(queryParamsWithoutSelectedEndpoint)); + }, [history, queryParamsWithoutSelectedEndpoint]); useEffect(() => { if (error !== undefined) { toasts.addDanger({ - title: i18n.translate('xpack.securitySolution.endpoint.host.details.errorTitle', { + title: i18n.translate('xpack.securitySolution.endpoint.details.errorTitle', { defaultMessage: 'Could not find host', }), - text: i18n.translate('xpack.securitySolution.endpoint.host.details.errorBody', { + text: i18n.translate('xpack.securitySolution.endpoint.details.errorBody', { defaultMessage: 'Please exit the flyout and select an available host.', }), }); @@ -73,12 +76,12 @@ export const HostDetailsFlyout = memo(() => { -

+

{loading ? : details?.host?.hostname}

@@ -93,8 +96,8 @@ export const HostDetailsFlyout = memo(() => { <> {show === 'details' && ( <> - - + + )} @@ -105,31 +108,31 @@ export const HostDetailsFlyout = memo(() => { ); }); -HostDetailsFlyout.displayName = 'HostDetailsFlyout'; +EndpointDetailsFlyout.displayName = 'EndpointDetailsFlyout'; const PolicyResponseFlyoutPanel = memo<{ hostMeta: HostMetadata; }>(({ hostMeta }) => { - const { show, ...queryParams } = useHostSelector(uiQueryParams); - const responseConfig = useHostSelector(policyResponseConfigurations); - const responseActions = useHostSelector(policyResponseActions); - const responseAttentionCount = useHostSelector(policyResponseFailedOrWarningActionCount); - const loading = useHostSelector(policyResponseLoading); - const error = useHostSelector(policyResponseError); + const { show, ...queryParams } = useEndpointSelector(uiQueryParams); + const responseConfig = useEndpointSelector(policyResponseConfigurations); + const responseActions = useEndpointSelector(policyResponseActions); + const responseAttentionCount = useEndpointSelector(policyResponseFailedOrWarningActionCount); + const loading = useEndpointSelector(policyResponseLoading); + const error = useEndpointSelector(policyResponseError); const { formatUrl } = useFormatUrl(SecurityPageName.administration); const [detailsUri, detailsRoutePath] = useMemo( () => [ formatUrl( - getHostListPath({ - name: 'hostList', + getEndpointListPath({ + name: 'endpointList', ...queryParams, - selected_host: hostMeta.host.id, + selected_endpoint: hostMeta.host.id, }) ), - getHostListPath({ - name: 'hostList', + getEndpointListPath({ + name: 'endpointList', ...queryParams, - selected_host: hostMeta.host.id, + selected_endpoint: hostMeta.host.id, }), ], [hostMeta.host.id, formatUrl, queryParams] @@ -137,7 +140,7 @@ const PolicyResponseFlyoutPanel = memo<{ const backToDetailsClickHandler = useNavigateByRouterEventHandler(detailsRoutePath); const backButtonProp = useMemo((): FlyoutSubHeaderProps['backButton'] => { return { - title: i18n.translate('xpack.securitySolution.endpoint.host.policyResponse.backLinkTitle', { + title: i18n.translate('xpack.securitySolution.endpoint.policyResponse.backLinkTitle', { defaultMessage: 'Endpoint Details', }), href: detailsUri, @@ -149,13 +152,13 @@ const PolicyResponseFlyoutPanel = memo<{ <> - - + +

@@ -164,7 +167,7 @@ const PolicyResponseFlyoutPanel = memo<{ } diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/policy_response.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/policy_response.tsx index 3a1dd180405e04..231e301a93aabe 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/policy_response.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/policy_response.tsx @@ -90,7 +90,7 @@ const ResponseActions = memo(

{formatResponse(key)}

@@ -162,7 +162,7 @@ export const PolicyResponse = memo( attentionCount > 0 && ( {attentionCount} diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/policy_response_friendly_names.ts b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/policy_response_friendly_names.ts index 020e8c9e38ad5e..07ab38fd527762 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/policy_response_friendly_names.ts +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/policy_response_friendly_names.ts @@ -9,198 +9,189 @@ import { i18n } from '@kbn/i18n'; const policyResponses: Array<[string, string]> = [ [ 'configure_dns_events', - i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_dns_events', - { defaultMessage: 'Configure DNS Events' } - ), + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.configure_dns_events', { + defaultMessage: 'Configure DNS Events', + }), ], [ 'configure_elasticsearch_connection', i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_elasticsearch_connection', + 'xpack.securitySolution.endpoint.details.policyResponse.configure_elasticsearch_connection', { defaultMessage: 'Configure Elastic Search Connection' } ), ], [ 'configure_file_events', - i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_file_events', - { defaultMessage: 'Configure File Events' } - ), + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.configure_file_events', { + defaultMessage: 'Configure File Events', + }), ], [ 'configure_imageload_events', i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_imageload_events', + 'xpack.securitySolution.endpoint.details.policyResponse.configure_imageload_events', { defaultMessage: 'Configure Image Load Events' } ), ], [ 'configure_kernel', - i18n.translate('xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_kernel', { + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.configure_kernel', { defaultMessage: 'Configure Kernel', }), ], [ 'configure_logging', - i18n.translate('xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_logging', { + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.configure_logging', { defaultMessage: 'Configure Logging', }), ], [ 'configure_malware', - i18n.translate('xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_malware', { + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.configure_malware', { defaultMessage: 'Configure Malware', }), ], [ 'configure_network_events', i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_network_events', + 'xpack.securitySolution.endpoint.details.policyResponse.configure_network_events', { defaultMessage: 'Configure Network Events' } ), ], [ 'configure_process_events', i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_process_events', + 'xpack.securitySolution.endpoint.details.policyResponse.configure_process_events', { defaultMessage: 'Configure Process Events' } ), ], [ 'configure_registry_events', i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_registry_events', + 'xpack.securitySolution.endpoint.details.policyResponse.configure_registry_events', { defaultMessage: 'Configure Registry Events' } ), ], [ 'configure_security_events', i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_security_events', + 'xpack.securitySolution.endpoint.details.policyResponse.configure_security_events', { defaultMessage: 'Configure Security Events' } ), ], [ 'connect_kernel', - i18n.translate('xpack.securitySolution.endpoint.hostDetails.policyResponse.connect_kernel', { + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.connect_kernel', { defaultMessage: 'Connect Kernel', }), ], [ 'detect_async_image_load_events', i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_async_image_load_events', + 'xpack.securitySolution.endpoint.details.policyResponse.detect_async_image_load_events', { defaultMessage: 'Detect Async Image Load Events' } ), ], [ 'detect_file_open_events', i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_file_open_events', + 'xpack.securitySolution.endpoint.details.policyResponse.detect_file_open_events', { defaultMessage: 'Detect File Open Events' } ), ], [ 'detect_file_write_events', i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_file_write_events', + 'xpack.securitySolution.endpoint.details.policyResponse.detect_file_write_events', { defaultMessage: 'Detect File Write Events' } ), ], [ 'detect_network_events', - i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_network_events', - { defaultMessage: 'Detect Network Events' } - ), + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.detect_network_events', { + defaultMessage: 'Detect Network Events', + }), ], [ 'detect_process_events', - i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_process_events', - { defaultMessage: 'Detect Process Events' } - ), + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.detect_process_events', { + defaultMessage: 'Detect Process Events', + }), ], [ 'detect_registry_events', i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_registry_events', + 'xpack.securitySolution.endpoint.details.policyResponse.detect_registry_events', { defaultMessage: 'Detect Registry Events' } ), ], [ 'detect_sync_image_load_events', i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_sync_image_load_events', + 'xpack.securitySolution.endpoint.details.policyResponse.detect_sync_image_load_events', { defaultMessage: 'Detect Sync Image Load Events' } ), ], [ 'download_global_artifacts', i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.download_global_artifacts', + 'xpack.securitySolution.endpoint.details.policyResponse.download_global_artifacts', { defaultMessage: 'Download Global Artifacts' } ), ], [ 'download_user_artifacts', i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.download_user_artifacts', + 'xpack.securitySolution.endpoint.details.policyResponse.download_user_artifacts', { defaultMessage: 'Download User Artifacts' } ), ], [ 'load_config', - i18n.translate('xpack.securitySolution.endpoint.hostDetails.policyResponse.load_config', { + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.load_config', { defaultMessage: 'Load Config', }), ], [ 'load_malware_model', - i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.load_malware_model', - { defaultMessage: 'Load Malware Model' } - ), + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.load_malware_model', { + defaultMessage: 'Load Malware Model', + }), ], [ 'read_elasticsearch_config', i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.read_elasticsearch_config', + 'xpack.securitySolution.endpoint.details.policyResponse.read_elasticsearch_config', { defaultMessage: 'Read ElasticSearch Config' } ), ], [ 'read_events_config', - i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.read_events_config', - { defaultMessage: 'Read Events Config' } - ), + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.read_events_config', { + defaultMessage: 'Read Events Config', + }), ], [ 'read_kernel_config', - i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.read_kernel_config', - { defaultMessage: 'Read Kernel Config' } - ), + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.read_kernel_config', { + defaultMessage: 'Read Kernel Config', + }), ], [ 'read_logging_config', - i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.read_logging_config', - { defaultMessage: 'Read Logging Config' } - ), + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.read_logging_config', { + defaultMessage: 'Read Logging Config', + }), ], [ 'read_malware_config', - i18n.translate( - 'xpack.securitySolution.endpoint.hostDetails.policyResponse.read_malware_config', - { defaultMessage: 'Read Malware Config' } - ), + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.read_malware_config', { + defaultMessage: 'Read Malware Config', + }), ], [ 'workflow', - i18n.translate('xpack.securitySolution.endpoint.hostDetails.policyResponse.workflow', { + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.workflow', { defaultMessage: 'Workflow', }), ], @@ -211,43 +202,43 @@ const responseMap = new Map(policyResponses); // Additional values used in the Policy Response UI responseMap.set( 'success', - i18n.translate('xpack.securitySolution.endpoint.hostDetails.policyResponse.success', { + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.success', { defaultMessage: 'Success', }) ); responseMap.set( 'warning', - i18n.translate('xpack.securitySolution.endpoint.hostDetails.policyResponse.warning', { + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.warning', { defaultMessage: 'Warning', }) ); responseMap.set( 'failure', - i18n.translate('xpack.securitySolution.endpoint.hostDetails.policyResponse.failed', { + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.failed', { defaultMessage: 'Failed', }) ); responseMap.set( 'logging', - i18n.translate('xpack.securitySolution.endpoint.hostDetails.policyResponse.logging', { + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.logging', { defaultMessage: 'Logging', }) ); responseMap.set( 'streaming', - i18n.translate('xpack.securitySolution.endpoint.hostDetails.policyResponse.streaming', { + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.streaming', { defaultMessage: 'Streaming', }) ); responseMap.set( 'malware', - i18n.translate('xpack.securitySolution.endpoint.hostDetails.policyResponse.malware', { + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.malware', { defaultMessage: 'Malware', }) ); responseMap.set( 'events', - i18n.translate('xpack.securitySolution.endpoint.hostDetails.policyResponse.events', { + i18n.translate('xpack.securitySolution.endpoint.details.policyResponse.events', { defaultMessage: 'Events', }) ); diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/hooks.ts b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/hooks.ts index d11335df875e97..a9c84678c88a96 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/hooks.ts +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/hooks.ts @@ -7,16 +7,18 @@ import { useSelector } from 'react-redux'; import { useMemo } from 'react'; import { useKibana } from '../../../../common/lib/kibana'; -import { HostState } from '../types'; +import { EndpointState } from '../types'; import { - MANAGEMENT_STORE_HOSTS_NAMESPACE, + MANAGEMENT_STORE_ENDPOINTS_NAMESPACE, MANAGEMENT_STORE_GLOBAL_NAMESPACE, } from '../../../common/constants'; import { State } from '../../../../common/store'; -export function useHostSelector(selector: (state: HostState) => TSelected) { +export function useEndpointSelector(selector: (state: EndpointState) => TSelected) { return useSelector(function (state: State) { return selector( - state[MANAGEMENT_STORE_GLOBAL_NAMESPACE][MANAGEMENT_STORE_HOSTS_NAMESPACE] as HostState + state[MANAGEMENT_STORE_GLOBAL_NAMESPACE][ + MANAGEMENT_STORE_ENDPOINTS_NAMESPACE + ] as EndpointState ); }); } diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.test.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.test.tsx index bb6003f73714d6..09df6d6ece042a 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.test.tsx @@ -7,12 +7,12 @@ import React from 'react'; import * as reactTestingLibrary from '@testing-library/react'; -import { HostList } from './index'; +import { EndpointList } from './index'; import { - mockHostDetailsApiResult, - mockHostResultList, - setHostListApiMockImplementation, -} from '../store/mock_host_result_list'; + mockEndpointDetailsApiResult, + mockEndpointResultList, + setEndpointListApiMockImplementation, +} from '../store/mock_endpoint_result_list'; import { AppContextTestRender, createAppRootMockRenderer } from '../../../../common/mock/endpoint'; import { HostInfo, @@ -27,7 +27,7 @@ import { mockPolicyResultList } from '../../policy/store/policy_list/test_mock_u jest.mock('../../../../common/components/link_to'); -describe('when on the hosts page', () => { +describe('when on the list page', () => { const docGenerator = new EndpointDocGenerator(); let render: () => ReturnType; let history: AppContextTestRender['history']; @@ -38,9 +38,9 @@ describe('when on the hosts page', () => { beforeEach(() => { const mockedContext = createAppRootMockRenderer(); ({ history, store, coreStart, middlewareSpy } = mockedContext); - render = () => mockedContext.render(); + render = () => mockedContext.render(); reactTestingLibrary.act(() => { - history.push('/hosts'); + history.push('/endpoints'); }); }); @@ -50,10 +50,10 @@ describe('when on the hosts page', () => { expect(timelineFlyout).toBeNull(); }); - describe('when there are no hosts or polices', () => { + describe('when there are no endpoints or polices', () => { beforeEach(() => { - setHostListApiMockImplementation(coreStart.http, { - hostsResults: [], + setEndpointListApiMockImplementation(coreStart.http, { + endpointsResults: [], }); }); @@ -70,8 +70,8 @@ describe('when on the hosts page', () => { describe('when there are policies, but no hosts', () => { beforeEach(async () => { - setHostListApiMockImplementation(coreStart.http, { - hostsResults: [], + setEndpointListApiMockImplementation(coreStart.http, { + endpointsResults: [], endpointPackageConfigs: mockPolicyResultList({ total: 3 }).items, }); }); @@ -111,7 +111,7 @@ describe('when on the hosts page', () => { it('should not show the flyout', () => { const renderResult = render(); expect.assertions(1); - return renderResult.findByTestId('hostDetailsFlyout').catch((e) => { + return renderResult.findByTestId('endpointDetailsFlyout').catch((e) => { expect(e).not.toBeNull(); }); }); @@ -122,7 +122,7 @@ describe('when on the hosts page', () => { let firstPolicyID: string; beforeEach(() => { reactTestingLibrary.act(() => { - const hostListData = mockHostResultList({ total: 4 }).hosts; + const hostListData = mockEndpointResultList({ total: 4 }).hosts; firstPolicyID = hostListData[0].metadata.Endpoint.policy.applied.id; @@ -142,8 +142,8 @@ describe('when on the hosts page', () => { const ingestPackageConfigs = mockPolicyResultList({ total: 1 }).items; ingestPackageConfigs[0].id = firstPolicyID; - setHostListApiMockImplementation(coreStart.http, { - hostsResults: hostListData, + setEndpointListApiMockImplementation(coreStart.http, { + endpointsResults: hostListData, endpointPackageConfigs: ingestPackageConfigs, }); }); @@ -152,7 +152,7 @@ describe('when on the hosts page', () => { it('should display rows in the table', async () => { const renderResult = render(); await reactTestingLibrary.act(async () => { - await middlewareSpy.waitForAction('serverReturnedHostList'); + await middlewareSpy.waitForAction('serverReturnedEndpointList'); }); const rows = await renderResult.findAllByRole('row'); expect(rows).toHaveLength(5); @@ -160,15 +160,15 @@ describe('when on the hosts page', () => { it('should show total', async () => { const renderResult = render(); await reactTestingLibrary.act(async () => { - await middlewareSpy.waitForAction('serverReturnedHostList'); + await middlewareSpy.waitForAction('serverReturnedEndpointList'); }); - const total = await renderResult.findByTestId('hostListTableTotal'); + const total = await renderResult.findByTestId('endpointListTableTotal'); expect(total.textContent).toEqual('4 Hosts'); }); it('should display correct status', async () => { const renderResult = render(); await reactTestingLibrary.act(async () => { - await middlewareSpy.waitForAction('serverReturnedHostList'); + await middlewareSpy.waitForAction('serverReturnedEndpointList'); }); const hostStatuses = await renderResult.findAllByTestId('rowHostStatus'); @@ -194,7 +194,7 @@ describe('when on the hosts page', () => { it('should display correct policy status', async () => { const renderResult = render(); await reactTestingLibrary.act(async () => { - await middlewareSpy.waitForAction('serverReturnedHostList'); + await middlewareSpy.waitForAction('serverReturnedEndpointList'); }); const policyStatuses = await renderResult.findAllByTestId('rowPolicyStatus'); @@ -213,7 +213,7 @@ describe('when on the hosts page', () => { it('should display policy name as a link', async () => { const renderResult = render(); await reactTestingLibrary.act(async () => { - await middlewareSpy.waitForAction('serverReturnedHostList'); + await middlewareSpy.waitForAction('serverReturnedEndpointList'); }); const firstPolicyName = (await renderResult.findAllByTestId('policyNameCellLink'))[0]; expect(firstPolicyName).not.toBeNull(); @@ -225,7 +225,7 @@ describe('when on the hosts page', () => { beforeEach(async () => { renderResult = render(); await reactTestingLibrary.act(async () => { - await middlewareSpy.waitForAction('serverReturnedHostList'); + await middlewareSpy.waitForAction('serverReturnedEndpointList'); }); const hostNameLinks = await renderResult.findAllByTestId('hostnameCellLink'); if (hostNameLinks.length) { @@ -234,7 +234,7 @@ describe('when on the hosts page', () => { }); it('should show the flyout', () => { - return renderResult.findByTestId('hostDetailsFlyout').then((flyout) => { + return renderResult.findByTestId('endpointDetailsFlyout').then((flyout) => { expect(flyout).not.toBeNull(); }); }); @@ -298,12 +298,12 @@ describe('when on the hosts page', () => { return policyResponse; }; - const dispatchServerReturnedHostPolicyResponse = ( + const dispatchServerReturnedEndpointPolicyResponse = ( overallStatus: HostPolicyResponseActionStatus = HostPolicyResponseActionStatus.success ) => { reactTestingLibrary.act(() => { store.dispatch({ - type: 'serverReturnedHostPolicyResponse', + type: 'serverReturnedEndpointPolicyResponse', payload: { policy_response: createPolicyResponse(overallStatus), }, @@ -316,7 +316,7 @@ describe('when on the hosts page', () => { // eslint-disable-next-line @typescript-eslint/naming-convention host_status, metadata: { host, ...details }, - } = mockHostDetailsApiResult(); + } = mockEndpointDetailsApiResult(); hostDetails = { host_status, @@ -334,18 +334,18 @@ describe('when on the hosts page', () => { const policy = docGenerator.generatePolicyPackageConfig(); policy.id = hostDetails.metadata.Endpoint.policy.applied.id; - setHostListApiMockImplementation(coreStart.http, { - hostsResults: [hostDetails], + setEndpointListApiMockImplementation(coreStart.http, { + endpointsResults: [hostDetails], endpointPackageConfigs: [policy], }); reactTestingLibrary.act(() => { - history.push('/hosts?selected_host=1'); + history.push('/endpoints?selected_endpoint=1'); }); renderAndWaitForData = async () => { const renderResult = render(); - await middlewareSpy.waitForAction('serverReturnedHostDetails'); + await middlewareSpy.waitForAction('serverReturnedEndpointDetails'); return renderResult; }; }); @@ -355,7 +355,7 @@ describe('when on the hosts page', () => { it('should show the flyout', async () => { const renderResult = await renderAndWaitForData(); - return renderResult.findByTestId('hostDetailsFlyout').then((flyout) => { + return renderResult.findByTestId('endpointDetailsFlyout').then((flyout) => { expect(flyout).not.toBeNull(); }); }); @@ -387,7 +387,7 @@ describe('when on the hosts page', () => { const policyStatusLink = await renderResult.findByTestId('policyStatusValue'); expect(policyStatusLink).not.toBeNull(); expect(policyStatusLink.getAttribute('href')).toEqual( - '/hosts?page_index=0&page_size=10&selected_host=1&show=policy_response' + '/endpoints?page_index=0&page_size=10&selected_endpoint=1&show=policy_response' ); }); @@ -400,14 +400,14 @@ describe('when on the hosts page', () => { }); const changedUrlAction = await userChangedUrlChecker; expect(changedUrlAction.payload.search).toEqual( - '?page_index=0&page_size=10&selected_host=1&show=policy_response' + '?page_index=0&page_size=10&selected_endpoint=1&show=policy_response' ); }); it('should display Success overall policy status', async () => { const renderResult = await renderAndWaitForData(); reactTestingLibrary.act(() => { - dispatchServerReturnedHostPolicyResponse(HostPolicyResponseActionStatus.success); + dispatchServerReturnedEndpointPolicyResponse(HostPolicyResponseActionStatus.success); }); const policyStatusLink = await renderResult.findByTestId('policyStatusValue'); expect(policyStatusLink.textContent).toEqual('Success'); @@ -421,7 +421,7 @@ describe('when on the hosts page', () => { it('should display Warning overall policy status', async () => { const renderResult = await renderAndWaitForData(); reactTestingLibrary.act(() => { - dispatchServerReturnedHostPolicyResponse(HostPolicyResponseActionStatus.warning); + dispatchServerReturnedEndpointPolicyResponse(HostPolicyResponseActionStatus.warning); }); const policyStatusLink = await renderResult.findByTestId('policyStatusValue'); expect(policyStatusLink.textContent).toEqual('Warning'); @@ -435,7 +435,7 @@ describe('when on the hosts page', () => { it('should display Failed overall policy status', async () => { const renderResult = await renderAndWaitForData(); reactTestingLibrary.act(() => { - dispatchServerReturnedHostPolicyResponse(HostPolicyResponseActionStatus.failure); + dispatchServerReturnedEndpointPolicyResponse(HostPolicyResponseActionStatus.failure); }); const policyStatusLink = await renderResult.findByTestId('policyStatusValue'); expect(policyStatusLink.textContent).toEqual('Failed'); @@ -449,7 +449,7 @@ describe('when on the hosts page', () => { it('should display Unknown overall policy status', async () => { const renderResult = await renderAndWaitForData(); reactTestingLibrary.act(() => { - dispatchServerReturnedHostPolicyResponse('' as HostPolicyResponseActionStatus); + dispatchServerReturnedEndpointPolicyResponse('' as HostPolicyResponseActionStatus); }); const policyStatusLink = await renderResult.findByTestId('policyStatusValue'); expect(policyStatusLink.textContent).toEqual('Unknown'); @@ -463,7 +463,7 @@ describe('when on the hosts page', () => { it('should include the link to reassignment in Ingest', async () => { coreStart.application.getUrlForApp.mockReturnValue('/app/ingestManager'); const renderResult = await renderAndWaitForData(); - const linkToReassign = await renderResult.findByTestId('hostDetailsLinkToIngest'); + const linkToReassign = await renderResult.findByTestId('endpointDetailsLinkToIngest'); expect(linkToReassign).not.toBeNull(); expect(linkToReassign.textContent).toEqual('Reassign Configuration'); expect(linkToReassign.getAttribute('href')).toEqual( @@ -475,7 +475,7 @@ describe('when on the hosts page', () => { beforeEach(async () => { coreStart.application.getUrlForApp.mockReturnValue('/app/ingestManager'); const renderResult = await renderAndWaitForData(); - const linkToReassign = await renderResult.findByTestId('hostDetailsLinkToIngest'); + const linkToReassign = await renderResult.findByTestId('endpointDetailsLinkToIngest'); reactTestingLibrary.act(() => { reactTestingLibrary.fireEvent.click(linkToReassign); }); @@ -491,7 +491,7 @@ describe('when on the hosts page', () => { beforeEach(async () => { coreStart.http.post.mockImplementation(async (requestOptions) => { if (requestOptions.path === '/api/endpoint/metadata') { - return mockHostResultList({ total: 0 }); + return mockEndpointResultList({ total: 0 }); } throw new Error(`POST to '${requestOptions.path}' does not have a mock response!`); }); @@ -502,44 +502,44 @@ describe('when on the hosts page', () => { reactTestingLibrary.fireEvent.click(policyStatusLink); }); await userChangedUrlChecker; - await middlewareSpy.waitForAction('serverReturnedHostPolicyResponse'); + await middlewareSpy.waitForAction('serverReturnedEndpointPolicyResponse'); reactTestingLibrary.act(() => { - dispatchServerReturnedHostPolicyResponse(); + dispatchServerReturnedEndpointPolicyResponse(); }); }); afterEach(reactTestingLibrary.cleanup); it('should hide the host details panel', async () => { - const hostDetailsFlyout = await renderResult.queryByTestId('hostDetailsFlyoutBody'); - expect(hostDetailsFlyout).toBeNull(); + const endpointDetailsFlyout = await renderResult.queryByTestId('endpointDetailsFlyoutBody'); + expect(endpointDetailsFlyout).toBeNull(); }); it('should display policy response sub-panel', async () => { expect( - await renderResult.findByTestId('hostDetailsPolicyResponseFlyoutHeader') + await renderResult.findByTestId('endpointDetailsPolicyResponseFlyoutHeader') ).not.toBeNull(); expect( - await renderResult.findByTestId('hostDetailsPolicyResponseFlyoutBody') + await renderResult.findByTestId('endpointDetailsPolicyResponseFlyoutBody') ).not.toBeNull(); }); it('should include the sub-panel title', async () => { expect( - (await renderResult.findByTestId('hostDetailsPolicyResponseFlyoutTitle')).textContent + (await renderResult.findByTestId('endpointDetailsPolicyResponseFlyoutTitle')).textContent ).toBe('Configuration Response'); }); it('should show a configuration section for each protection', async () => { const configAccordions = await renderResult.findAllByTestId( - 'hostDetailsPolicyResponseConfigAccordion' + 'endpointDetailsPolicyResponseConfigAccordion' ); expect(configAccordions).not.toBeNull(); }); it('should show an actions section for each configuration', async () => { const actionAccordions = await renderResult.findAllByTestId( - 'hostDetailsPolicyResponseActionsAccordion' + 'endpointDetailsPolicyResponseActionsAccordion' ); const action = await renderResult.findAllByTestId('policyResponseAction'); const statusHealth = await renderResult.findAllByTestId('policyResponseStatusHealth'); @@ -557,14 +557,14 @@ describe('when on the hosts page', () => { ); reactTestingLibrary.act(() => { store.dispatch({ - type: 'serverReturnedHostPolicyResponse', + type: 'serverReturnedEndpointPolicyResponse', payload: { policy_response: policyResponse, }, }); }); return renderResult - .findAllByTestId('hostDetailsPolicyResponseAttentionBadge') + .findAllByTestId('endpointDetailsPolicyResponseAttentionBadge') .catch((e) => { expect(e).not.toBeNull(); }); @@ -572,28 +572,28 @@ describe('when on the hosts page', () => { it('should show a numbered badge if at least one action failed', async () => { const policyResponseActionDispatched = middlewareSpy.waitForAction( - 'serverReturnedHostPolicyResponse' + 'serverReturnedEndpointPolicyResponse' ); reactTestingLibrary.act(() => { - dispatchServerReturnedHostPolicyResponse(HostPolicyResponseActionStatus.failure); + dispatchServerReturnedEndpointPolicyResponse(HostPolicyResponseActionStatus.failure); }); await policyResponseActionDispatched; const attentionBadge = await renderResult.findAllByTestId( - 'hostDetailsPolicyResponseAttentionBadge' + 'endpointDetailsPolicyResponseAttentionBadge' ); expect(attentionBadge).not.toBeNull(); }); it('should show a numbered badge if at least one action has a warning', async () => { const policyResponseActionDispatched = middlewareSpy.waitForAction( - 'serverReturnedHostPolicyResponse' + 'serverReturnedEndpointPolicyResponse' ); reactTestingLibrary.act(() => { - dispatchServerReturnedHostPolicyResponse(HostPolicyResponseActionStatus.warning); + dispatchServerReturnedEndpointPolicyResponse(HostPolicyResponseActionStatus.warning); }); await policyResponseActionDispatched; const attentionBadge = await renderResult.findAllByTestId( - 'hostDetailsPolicyResponseAttentionBadge' + 'endpointDetailsPolicyResponseAttentionBadge' ); expect(attentionBadge).not.toBeNull(); }); @@ -602,7 +602,7 @@ describe('when on the hosts page', () => { const subHeaderBackLink = await renderResult.findByTestId('flyoutSubHeaderBackButton'); expect(subHeaderBackLink.textContent).toBe('Endpoint Details'); expect(subHeaderBackLink.getAttribute('href')).toBe( - '/hosts?page_index=0&page_size=10&selected_host=1' + '/endpoints?page_index=0&page_size=10&selected_endpoint=1' ); }); @@ -614,7 +614,7 @@ describe('when on the hosts page', () => { }); const changedUrlAction = await userChangedUrlChecker; expect(changedUrlAction.payload.search).toEqual( - '?page_index=0&page_size=10&selected_host=1' + '?page_index=0&page_size=10&selected_endpoint=1' ); }); diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.tsx index cdea4bfcf9f86d..a923d49012d70d 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.tsx @@ -25,9 +25,9 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { createStructuredSelector } from 'reselect'; import { useDispatch } from 'react-redux'; -import { HostDetailsFlyout } from './details'; +import { EndpointDetailsFlyout } from './details'; import * as selectors from '../store/selectors'; -import { useHostSelector } from './hooks'; +import { useEndpointSelector } from './hooks'; import { HOST_STATUS_TO_HEALTH_COLOR, POLICY_STATUS_TO_HEALTH_COLOR, @@ -46,12 +46,12 @@ import { AgentConfigDetailsDeployAgentAction, } from '../../../../../../ingest_manager/public'; import { SecurityPageName } from '../../../../app/types'; -import { getHostListPath, getHostDetailsPath } from '../../../common/routing'; +import { getEndpointListPath, getEndpointDetailsPath } from '../../../common/routing'; import { useFormatUrl } from '../../../../common/components/link_to'; -import { HostAction } from '../store/action'; -import { HostPolicyLink } from './components/host_policy_link'; +import { EndpointAction } from '../store/action'; +import { EndpointPolicyLink } from './components/endpoint_policy_link'; -const HostListNavLink = memo<{ +const EndpointListNavLink = memo<{ name: string; href: string; route: string; @@ -71,10 +71,10 @@ const HostListNavLink = memo<{ ); }); -HostListNavLink.displayName = 'HostListNavLink'; +EndpointListNavLink.displayName = 'EndpointListNavLink'; const selector = (createStructuredSelector as CreateStructuredSelector)(selectors); -export const HostList = () => { +export const EndpointList = () => { const history = useHistory(); const { listData, @@ -84,16 +84,16 @@ export const HostList = () => { listLoading: loading, listError, uiQueryParams: queryParams, - hasSelectedHost, + hasSelectedEndpoint, policyItems, selectedPolicyId, policyItemsLoading, endpointPackageVersion, - hostsExist, - } = useHostSelector(selector); + endpointsExist, + } = useEndpointSelector(selector); const { formatUrl, search } = useFormatUrl(SecurityPageName.administration); - const dispatch = useDispatch<(a: HostAction) => void>(); + const dispatch = useDispatch<(a: EndpointAction) => void>(); const paginationSetup = useMemo(() => { return { @@ -108,10 +108,10 @@ export const HostList = () => { const onTableChange = useCallback( ({ page }: { page: { index: number; size: number } }) => { const { index, size } = page; - // FIXME: PT: if host details is open, table is not displaying correct number of rows + // FIXME: PT: if endpoint details is open, table is not displaying correct number of rows history.push( - getHostListPath({ - name: 'hostList', + getEndpointListPath({ + name: 'endpointList', ...queryParams, page_index: JSON.stringify(index), page_size: JSON.stringify(size), @@ -130,12 +130,12 @@ export const HostList = () => { state: { onCancelNavigateTo: [ 'securitySolution:administration', - { path: getHostListPath({ name: 'hostList' }) }, + { path: getEndpointListPath({ name: 'endpointList' }) }, ], - onCancelUrl: formatUrl(getHostListPath({ name: 'hostList' })), + onCancelUrl: formatUrl(getEndpointListPath({ name: 'endpointList' })), onSaveNavigateTo: [ 'securitySolution:administration', - { path: getHostListPath({ name: 'hostList' }) }, + { path: getEndpointListPath({ name: 'endpointList' }) }, ], }, } @@ -148,7 +148,7 @@ export const HostList = () => { state: { onDoneNavigateTo: [ 'securitySolution:administration', - { path: getHostListPath({ name: 'hostList' }) }, + { path: getEndpointListPath({ name: 'endpointList' }) }, ], }, }); @@ -183,28 +183,28 @@ export const HostList = () => { ); const columns: Array>> = useMemo(() => { - const lastActiveColumnName = i18n.translate('xpack.securitySolution.endpointList.lastActive', { + const lastActiveColumnName = i18n.translate('xpack.securitySolution.endpoint.list.lastActive', { defaultMessage: 'Last Active', }); return [ { field: 'metadata.host', - name: i18n.translate('xpack.securitySolution.endpointList.hostname', { + name: i18n.translate('xpack.securitySolution.endpoint.list.hostname', { defaultMessage: 'Hostname', }), render: ({ hostname, id }: HostInfo['metadata']['host']) => { - const toRoutePath = getHostDetailsPath( + const toRoutePath = getEndpointDetailsPath( { ...queryParams, - name: 'hostDetails', - selected_host: id, + name: 'endpointDetails', + selected_endpoint: id, }, search ); const toRouteUrl = formatUrl(toRoutePath); return ( - { }, { field: 'host_status', - name: i18n.translate('xpack.securitySolution.endpointList.hostStatus', { - defaultMessage: 'Host Status', + name: i18n.translate('xpack.securitySolution.endpoint.list.hostStatus', { + defaultMessage: 'Agent Status', }), // eslint-disable-next-line react/display-name render: (hostStatus: HostInfo['host_status']) => { @@ -227,7 +227,7 @@ export const HostList = () => { className="eui-textTruncate" > @@ -237,33 +237,33 @@ export const HostList = () => { }, { field: 'metadata.Endpoint.policy.applied', - name: i18n.translate('xpack.securitySolution.endpointList.policy', { + name: i18n.translate('xpack.securitySolution.endpoint.list.policy', { defaultMessage: 'Integration', }), truncateText: true, // eslint-disable-next-line react/display-name render: (policy: HostInfo['metadata']['Endpoint']['policy']['applied']) => { return ( - {policy.name} - + ); }, }, { field: 'metadata.Endpoint.policy.applied', - name: i18n.translate('xpack.securitySolution.endpointList.policyStatus', { + name: i18n.translate('xpack.securitySolution.endpoint.list.policyStatus', { defaultMessage: 'Configuration Status', }), render: (policy: HostInfo['metadata']['Endpoint']['policy']['applied'], item: HostInfo) => { - const toRoutePath = getHostDetailsPath({ - name: 'hostPolicyResponse', + const toRoutePath = getEndpointDetailsPath({ + name: 'endpointPolicyResponse', ...queryParams, - selected_host: item.metadata.host.id, + selected_endpoint: item.metadata.host.id, }); const toRouteUrl = formatUrl(toRoutePath); return ( @@ -272,7 +272,7 @@ export const HostList = () => { className="eui-textTruncate" data-test-subj="rowPolicyStatus" > - { }, { field: 'metadata.host.os.name', - name: i18n.translate('xpack.securitySolution.endpointList.os', { + name: i18n.translate('xpack.securitySolution.endpoint.list.os', { defaultMessage: 'Operating System', }), truncateText: true, }, { field: 'metadata.host.ip', - name: i18n.translate('xpack.securitySolution.endpointList.ip', { + name: i18n.translate('xpack.securitySolution.endpoint.list.ip', { defaultMessage: 'IP Address', }), // eslint-disable-next-line react/display-name @@ -309,7 +309,7 @@ export const HostList = () => { }, { field: 'metadata.agent.version', - name: i18n.translate('xpack.securitySolution.endpointList.endpointVersion', { + name: i18n.translate('xpack.securitySolution.endpoint.list.endpointVersion', { defaultMessage: 'Version', }), }, @@ -330,10 +330,10 @@ export const HostList = () => { }, [formatUrl, queryParams, search]); const renderTableOrEmptyState = useMemo(() => { - if (hostsExist) { + if (endpointsExist) { return ( { } }, [ loading, - hostsExist, + endpointsExist, policyItemsLoading, policyItems, listData, @@ -377,7 +377,7 @@ export const HostList = () => { return ( @@ -385,15 +385,15 @@ export const HostList = () => {

@@ -403,7 +403,7 @@ export const HostList = () => {

@@ -411,12 +411,12 @@ export const HostList = () => { } > - {hasSelectedHost && } + {hasSelectedEndpoint && } {listData && listData.length > 0 && ( <> - + diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/url_from_query_params.ts b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/url_from_query_params.ts index a14f1d0d0dd6c3..c421f513556f42 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/url_from_query_params.ts +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/url_from_query_params.ts @@ -7,10 +7,10 @@ // eslint-disable-next-line import/no-nodejs-modules import querystring from 'querystring'; -import { HostIndexUIQueryParams } from '../types'; +import { EndpointIndexUIQueryParams } from '../types'; import { AppLocation } from '../../../../../common/endpoint/types'; -export function urlFromQueryParams(queryParams: HostIndexUIQueryParams): Partial { +export function urlFromQueryParams(queryParams: EndpointIndexUIQueryParams): Partial { const search = querystring.stringify(queryParams); return { search, diff --git a/x-pack/plugins/security_solution/public/management/pages/index.test.tsx b/x-pack/plugins/security_solution/public/management/pages/index.test.tsx index 5ec42671ec3d21..9e496ce6c0b505 100644 --- a/x-pack/plugins/security_solution/public/management/pages/index.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/index.test.tsx @@ -30,7 +30,7 @@ describe('when in the Admistration tab', () => { it('should display the Management view when Ingest is ON', async () => { (useIngestEnabledCheck as jest.Mock).mockReturnValue({ allEnabled: true }); const renderResult = render(); - const hostPage = await renderResult.findByTestId('hostPage'); - expect(hostPage).not.toBeNull(); + const endpointPage = await renderResult.findByTestId('endpointPage'); + expect(endpointPage).not.toBeNull(); }); }); diff --git a/x-pack/plugins/security_solution/public/management/pages/index.tsx b/x-pack/plugins/security_solution/public/management/pages/index.tsx index 3e1c0743fb4f1f..c20a3dd31d6a4d 100644 --- a/x-pack/plugins/security_solution/public/management/pages/index.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/index.tsx @@ -13,24 +13,24 @@ import { EuiText, EuiEmptyPrompt } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { PolicyContainer } from './policy'; import { - MANAGEMENT_ROUTING_HOSTS_PATH, + MANAGEMENT_ROUTING_ENDPOINTS_PATH, MANAGEMENT_ROUTING_POLICIES_PATH, MANAGEMENT_ROUTING_ROOT_PATH, } from '../common/constants'; import { NotFoundPage } from '../../app/404'; -import { HostsContainer } from './endpoint_hosts'; -import { getHostListPath } from '../common/routing'; +import { EndpointsContainer } from './endpoint_hosts'; +import { getEndpointListPath } from '../common/routing'; import { APP_ID, SecurityPageName } from '../../../common/constants'; import { GetUrlForApp } from '../../common/components/navigation/types'; import { AdministrationRouteSpyState } from '../../common/utils/route/types'; import { ADMINISTRATION } from '../../app/home/translations'; import { AdministrationSubTab } from '../types'; -import { HOSTS_TAB, POLICIES_TAB } from '../common/translations'; +import { ENDPOINTS_TAB, POLICIES_TAB } from '../common/translations'; import { SpyRoute } from '../../common/utils/route/spy_routes'; import { useIngestEnabledCheck } from '../../common/hooks/endpoint/ingest_enabled'; const TabNameMappedToI18nKey: Record = { - [AdministrationSubTab.hosts]: HOSTS_TAB, + [AdministrationSubTab.endpoints]: ENDPOINTS_TAB, [AdministrationSubTab.policies]: POLICIES_TAB, }; @@ -102,13 +102,13 @@ export const ManagementContainer = memo(() => { return ( - + { - history.replace(getHostListPath({ name: 'hostList' })); + history.replace(getEndpointListPath({ name: 'endpointList' })); return null; }} /> diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/agents_summary.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/agents_summary.tsx index 921493e239c0fc..5dbd1b6ff49190 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/agents_summary.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/agents_summary.tsx @@ -34,7 +34,7 @@ export const AgentsSummary = memo((props) => { title: i18n.translate( 'xpack.securitySolution.endpoint.policyDetails.agentsSummary.totalTitle', { - defaultMessage: 'Hosts', + defaultMessage: 'Endpoints', } ), health: '', diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.test.tsx index c81ffb0060c888..c934cfb94fc7e9 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.test.tsx @@ -10,7 +10,7 @@ import { mount } from 'enzyme'; import { PolicyDetails } from './policy_details'; import { EndpointDocGenerator } from '../../../../../common/endpoint/generate_data'; import { AppContextTestRender, createAppRootMockRenderer } from '../../../../common/mock/endpoint'; -import { getPolicyDetailPath, getHostListPath } from '../../../common/routing'; +import { getPolicyDetailPath, getEndpointListPath } from '../../../common/routing'; import { policyListApiPathHandlers } from '../store/policy_list/test_mock_utils'; jest.mock('../../../../common/components/link_to'); @@ -19,7 +19,7 @@ describe('Policy Details', () => { type FindReactWrapperResponse = ReturnType['find']>; const policyDetailsPathUrl = getPolicyDetailPath('1'); - const hostListPath = getHostListPath({ name: 'hostList' }); + const endpointListPath = getEndpointListPath({ name: 'endpointList' }); const sleep = (ms = 100) => new Promise((wakeup) => setTimeout(wakeup, ms)); const generator = new EndpointDocGenerator(); let history: AppContextTestRender['history']; @@ -129,7 +129,7 @@ describe('Policy Details', () => { const backToListButton = pageHeaderLeft.find('EuiButtonEmpty'); expect(backToListButton.prop('iconType')).toBe('arrowLeft'); - expect(backToListButton.prop('href')).toBe(hostListPath); + expect(backToListButton.prop('href')).toBe(endpointListPath); expect(backToListButton.text()).toBe('Back to endpoint hosts'); const pageTitle = pageHeaderLeft.find('[data-test-subj="pageViewHeaderLeftTitle"]'); @@ -143,7 +143,7 @@ describe('Policy Details', () => { ); expect(history.location.pathname).toEqual(policyDetailsPathUrl); backToListButton.simulate('click', { button: 0 }); - expect(history.location.pathname).toEqual(hostListPath); + expect(history.location.pathname).toEqual(endpointListPath); }); it('should display agent stats', async () => { await asyncActions; @@ -153,7 +153,7 @@ describe('Policy Details', () => { ); const agentsSummary = headerRight.find('EuiFlexGroup[data-test-subj="policyAgentsSummary"]'); expect(agentsSummary).toHaveLength(1); - expect(agentsSummary.text()).toBe('Hosts5Online3Offline1Error1'); + expect(agentsSummary.text()).toBe('Endpoints5Online3Offline1Error1'); }); it('should display cancel button', async () => { await asyncActions; @@ -175,7 +175,7 @@ describe('Policy Details', () => { const navigateToAppMockedCalls = coreStart.application.navigateToApp.mock.calls; expect(navigateToAppMockedCalls[navigateToAppMockedCalls.length - 1]).toEqual([ 'securitySolution:administration', - { path: hostListPath }, + { path: endpointListPath }, ]); }); it('should display save button', async () => { diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.tsx index d309faf59d0443..e54e684d788c08 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.tsx @@ -43,7 +43,7 @@ import { PageViewHeaderTitle } from '../../../../common/components/endpoint/page import { ManagementPageView } from '../../../components/management_page_view'; import { SpyRoute } from '../../../../common/utils/route/spy_routes'; import { SecurityPageName } from '../../../../app/types'; -import { getHostListPath } from '../../../common/routing'; +import { getEndpointListPath } from '../../../common/routing'; import { useFormatUrl } from '../../../../common/components/link_to'; import { useNavigateToAppEventHandler } from '../../../../common/hooks/endpoint/use_navigate_to_app_event_handler'; import { MANAGEMENT_APP_ID } from '../../../common/constants'; @@ -71,7 +71,7 @@ export const PolicyDetails = React.memo(() => { const [showConfirm, setShowConfirm] = useState(false); const [routeState, setRouteState] = useState(); const policyName = policyItem?.name ?? ''; - const hostListRouterPath = getHostListPath({ name: 'hostList' }); + const hostListRouterPath = getEndpointListPath({ name: 'endpointList' }); // Handle showing update statuses useEffect(() => { diff --git a/x-pack/plugins/security_solution/public/management/store/middleware.ts b/x-pack/plugins/security_solution/public/management/store/middleware.ts index a29da9bef58750..c7a7d2cad06233 100644 --- a/x-pack/plugins/security_solution/public/management/store/middleware.ts +++ b/x-pack/plugins/security_solution/public/management/store/middleware.ts @@ -12,19 +12,19 @@ import { import { policyListMiddlewareFactory } from '../pages/policy/store/policy_list'; import { policyDetailsMiddlewareFactory } from '../pages/policy/store/policy_details'; import { - MANAGEMENT_STORE_HOSTS_NAMESPACE, + MANAGEMENT_STORE_ENDPOINTS_NAMESPACE, MANAGEMENT_STORE_GLOBAL_NAMESPACE, MANAGEMENT_STORE_POLICY_DETAILS_NAMESPACE, MANAGEMENT_STORE_POLICY_LIST_NAMESPACE, } from '../common/constants'; -import { hostMiddlewareFactory } from '../pages/endpoint_hosts/store/middleware'; +import { endpointMiddlewareFactory } from '../pages/endpoint_hosts/store/middleware'; const policyListSelector = (state: State) => state[MANAGEMENT_STORE_GLOBAL_NAMESPACE][MANAGEMENT_STORE_POLICY_LIST_NAMESPACE]; const policyDetailsSelector = (state: State) => state[MANAGEMENT_STORE_GLOBAL_NAMESPACE][MANAGEMENT_STORE_POLICY_DETAILS_NAMESPACE]; const endpointsSelector = (state: State) => - state[MANAGEMENT_STORE_GLOBAL_NAMESPACE][MANAGEMENT_STORE_HOSTS_NAMESPACE]; + state[MANAGEMENT_STORE_GLOBAL_NAMESPACE][MANAGEMENT_STORE_ENDPOINTS_NAMESPACE]; export const managementMiddlewareFactory: SecuritySubPluginMiddlewareFactory = ( coreStart, @@ -39,6 +39,6 @@ export const managementMiddlewareFactory: SecuritySubPluginMiddlewareFactory = ( policyDetailsSelector, policyDetailsMiddlewareFactory(coreStart, depsStart) ), - substateMiddlewareFactory(endpointsSelector, hostMiddlewareFactory(coreStart, depsStart)), + substateMiddlewareFactory(endpointsSelector, endpointMiddlewareFactory(coreStart, depsStart)), ]; }; diff --git a/x-pack/plugins/security_solution/public/management/store/reducer.ts b/x-pack/plugins/security_solution/public/management/store/reducer.ts index f3c470fb1e8a3a..eafd69c875ff15 100644 --- a/x-pack/plugins/security_solution/public/management/store/reducer.ts +++ b/x-pack/plugins/security_solution/public/management/store/reducer.ts @@ -14,14 +14,17 @@ import { initialPolicyListState, } from '../pages/policy/store/policy_list/reducer'; import { - MANAGEMENT_STORE_HOSTS_NAMESPACE, + MANAGEMENT_STORE_ENDPOINTS_NAMESPACE, MANAGEMENT_STORE_POLICY_DETAILS_NAMESPACE, MANAGEMENT_STORE_POLICY_LIST_NAMESPACE, } from '../common/constants'; import { ImmutableCombineReducers } from '../../common/store'; import { Immutable } from '../../../common/endpoint/types'; import { ManagementState } from '../types'; -import { hostListReducer, initialHostListState } from '../pages/endpoint_hosts/store/reducer'; +import { + endpointListReducer, + initialEndpointListState, +} from '../pages/endpoint_hosts/store/reducer'; const immutableCombineReducers: ImmutableCombineReducers = combineReducers; @@ -31,7 +34,7 @@ const immutableCombineReducers: ImmutableCombineReducers = combineReducers; export const mockManagementState: Immutable = { [MANAGEMENT_STORE_POLICY_LIST_NAMESPACE]: initialPolicyListState(), [MANAGEMENT_STORE_POLICY_DETAILS_NAMESPACE]: initialPolicyDetailsState(), - [MANAGEMENT_STORE_HOSTS_NAMESPACE]: initialHostListState, + [MANAGEMENT_STORE_ENDPOINTS_NAMESPACE]: initialEndpointListState, }; /** @@ -40,5 +43,5 @@ export const mockManagementState: Immutable = { export const managementReducer = immutableCombineReducers({ [MANAGEMENT_STORE_POLICY_LIST_NAMESPACE]: policyListReducer, [MANAGEMENT_STORE_POLICY_DETAILS_NAMESPACE]: policyDetailsReducer, - [MANAGEMENT_STORE_HOSTS_NAMESPACE]: hostListReducer, + [MANAGEMENT_STORE_ENDPOINTS_NAMESPACE]: endpointListReducer, }); diff --git a/x-pack/plugins/security_solution/public/management/types.ts b/x-pack/plugins/security_solution/public/management/types.ts index 86959caaba4f4a..c35c9277b44885 100644 --- a/x-pack/plugins/security_solution/public/management/types.ts +++ b/x-pack/plugins/security_solution/public/management/types.ts @@ -7,7 +7,7 @@ import { CombinedState } from 'redux'; import { SecurityPageName } from '../app/types'; import { PolicyListState, PolicyDetailsState } from './pages/policy/types'; -import { HostState } from './pages/endpoint_hosts/types'; +import { EndpointState } from './pages/endpoint_hosts/types'; /** * The type for the management store global namespace. Used mostly internally to reference @@ -18,14 +18,14 @@ export type ManagementStoreGlobalNamespace = 'management'; export type ManagementState = CombinedState<{ policyList: PolicyListState; policyDetails: PolicyDetailsState; - hosts: HostState; + endpoints: EndpointState; }>; /** * The management list of sub-tabs. Changes to these will impact the Router routes. */ export enum AdministrationSubTab { - hosts = 'hosts', + endpoints = 'endpoints', policies = 'policy', } diff --git a/x-pack/plugins/security_solution/public/overview/components/endpoint_notice/index.tsx b/x-pack/plugins/security_solution/public/overview/components/endpoint_notice/index.tsx index 1d726a7dbd9017..8b73253157edc0 100644 --- a/x-pack/plugins/security_solution/public/overview/components/endpoint_notice/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/endpoint_notice/index.tsx @@ -7,13 +7,13 @@ import React, { memo } from 'react'; import { EuiCallOut, EuiButton, EuiButtonEmpty } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { getHostListPath } from '../../../management/common/routing'; +import { getEndpointListPath } from '../../../management/common/routing'; import { useNavigateToAppEventHandler } from '../../../common/hooks/endpoint/use_navigate_to_app_event_handler'; import { useManagementFormatUrl } from '../../../management/components/hooks/use_management_format_url'; import { MANAGEMENT_APP_ID } from '../../../management/common/constants'; export const EndpointNotice = memo<{ onDismiss: () => void }>(({ onDismiss }) => { - const endpointsPath = getHostListPath({ name: 'hostList' }); + const endpointsPath = getEndpointListPath({ name: 'endpointList' }); const endpointsLink = useManagementFormatUrl(endpointsPath); const handleGetStartedClick = useNavigateToAppEventHandler(MANAGEMENT_APP_ID, { path: endpointsPath, diff --git a/x-pack/plugins/security_solution/public/resolver/mocks/endpoint_event.ts b/x-pack/plugins/security_solution/public/resolver/mocks/endpoint_event.ts index c822fdf647c169..083f6b8baa59f2 100644 --- a/x-pack/plugins/security_solution/public/resolver/mocks/endpoint_event.ts +++ b/x-pack/plugins/security_solution/public/resolver/mocks/endpoint_event.ts @@ -15,12 +15,14 @@ export function mockEndpointEvent({ parentEntityId, timestamp, lifecycleType, + pid = 0, }: { entityID: string; name: string; parentEntityId?: string; timestamp: number; lifecycleType?: string; + pid?: number; }): EndpointEvent { return { '@timestamp': timestamp, @@ -45,7 +47,7 @@ export function mockEndpointEvent({ executable: 'executable', args: 'args', name, - pid: 0, + pid, hash: { md5: 'hash.md5', }, diff --git a/x-pack/plugins/security_solution/public/resolver/mocks/resolver_tree.ts b/x-pack/plugins/security_solution/public/resolver/mocks/resolver_tree.ts index 5d2cbb2eab0dc2..7edf4f8071ed8c 100644 --- a/x-pack/plugins/security_solution/public/resolver/mocks/resolver_tree.ts +++ b/x-pack/plugins/security_solution/public/resolver/mocks/resolver_tree.ts @@ -175,18 +175,21 @@ export function mockTreeWithNoAncestorsAnd2Children({ secondChildID: string; }): ResolverTree { const origin: ResolverEvent = mockEndpointEvent({ + pid: 0, entityID: originID, name: 'c', parentEntityId: 'none', timestamp: 0, }); const firstChild: ResolverEvent = mockEndpointEvent({ + pid: 1, entityID: firstChildID, name: 'd', parentEntityId: originID, timestamp: 1, }); const secondChild: ResolverEvent = mockEndpointEvent({ + pid: 2, entityID: secondChildID, name: 'e', parentEntityId: originID, diff --git a/x-pack/plugins/security_solution/public/resolver/test_utilities/connect_enzyme_wrapper_and_store.ts b/x-pack/plugins/security_solution/public/resolver/test_utilities/connect_enzyme_wrapper_and_store.ts deleted file mode 100644 index 3a4a1f7d634d11..00000000000000 --- a/x-pack/plugins/security_solution/public/resolver/test_utilities/connect_enzyme_wrapper_and_store.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { Store } from 'redux'; -import { ReactWrapper } from 'enzyme'; - -/** - * We use the full-DOM emulation mode of `enzyme` via `mount`. Even though we use `react-redux`, `enzyme` - * does not update the DOM after state transitions. This subscribes to the `redux` store and after any state - * transition it asks `enzyme` to update the DOM to match the React state. - */ -export function connectEnzymeWrapperAndStore(store: Store, wrapper: ReactWrapper): void { - store.subscribe(() => { - // See https://enzymejs.github.io/enzyme/docs/api/ReactWrapper/update.html - return wrapper.update(); - }); -} diff --git a/x-pack/plugins/security_solution/public/resolver/test_utilities/simulator/index.tsx b/x-pack/plugins/security_solution/public/resolver/test_utilities/simulator/index.tsx index 6f44c5aee7cac8..cae6a18576ebd4 100644 --- a/x-pack/plugins/security_solution/public/resolver/test_utilities/simulator/index.tsx +++ b/x-pack/plugins/security_solution/public/resolver/test_utilities/simulator/index.tsx @@ -10,7 +10,6 @@ import { mount, ReactWrapper } from 'enzyme'; import { createMemoryHistory, History as HistoryPackageHistoryInterface } from 'history'; import { CoreStart } from '../../../../../../../src/core/public'; import { coreMock } from '../../../../../../../src/core/public/mocks'; -import { connectEnzymeWrapperAndStore } from '../connect_enzyme_wrapper_and_store'; import { spyMiddlewareFactory } from '../spy_middleware_factory'; import { resolverMiddlewareFactory } from '../../store/middleware'; import { resolverReducer } from '../../store/reducer'; @@ -48,6 +47,7 @@ export class Simulator { dataAccessLayer, resolverComponentInstanceID, databaseDocumentID, + history, }: { /** * A (mock) data access layer that will be used to create the Resolver store. @@ -61,6 +61,7 @@ export class Simulator { * a databaseDocumentID to pass to Resolver. Resolver will use this in requests to the mock data layer. */ databaseDocumentID?: string; + history?: HistoryPackageHistoryInterface; }) { this.resolverComponentInstanceID = resolverComponentInstanceID; // create the spy middleware (for debugging tests) @@ -79,8 +80,9 @@ export class Simulator { // Create a redux store w/ the top level Resolver reducer and the enhancer that includes the Resolver middleware and the `spyMiddleware` this.store = createStore(resolverReducer, middlewareEnhancer); - // Create a fake 'history' instance that Resolver will use to read and write query string values - this.history = createMemoryHistory(); + // If needed, create a fake 'history' instance. + // Resolver will use to read and write query string values. + this.history = history ?? createMemoryHistory(); // Used for `KibanaContextProvider` const coreStart: CoreStart = coreMock.createStart(); @@ -95,9 +97,6 @@ export class Simulator { databaseDocumentID={databaseDocumentID} /> ); - - // Update the enzyme wrapper after each state transition - connectEnzymeWrapperAndStore(this.store, this.wrapper); } /** @@ -112,6 +111,16 @@ export class Simulator { return this.spyMiddleware.debugActions(); } + /** + * EUI uses a component called `AutoSizer` that won't render its children unless it has sufficient size. + * This forces any `AutoSizer` instances to have a large size. + */ + private forceAutoSizerOpen() { + this.wrapper + .find('AutoSizer') + .forEach((wrapper) => wrapper.setState({ width: 10000, height: 10000 })); + } + /** * Yield the result of `mapper` over and over, once per event-loop cycle. * After 10 times, quit. @@ -124,6 +133,7 @@ export class Simulator { yield mapper(); await new Promise((resolve) => { setTimeout(() => { + this.forceAutoSizerOpen(); this.wrapper.update(); resolve(); }, 0); @@ -174,6 +184,13 @@ export class Simulator { ); } + /** + * The items in the submenu that is opened by expanding a node in the map. + */ + public processNodeSubmenuItems(): ReactWrapper { + return this.domNodes('[data-test-subj="resolver:map:node-submenu-item"]'); + } + /** * Return the selected node query string values. */ @@ -206,38 +223,38 @@ export class Simulator { } /** - * An element with a list of all nodes. + * The titles of the links that select a node in the node list view. */ - public nodeListElement(): ReactWrapper { - return this.domNodes('[data-test-subj="resolver:node-list"]'); + public nodeListNodeLinkText(): ReactWrapper { + return this.domNodes('[data-test-subj="resolver:node-list:node-link:title"]'); } /** - * Return the items in the node list (the default panel view.) + * The icons in the links that select a node in the node list view. */ - public nodeListItems(): ReactWrapper { - return this.domNodes('[data-test-subj="resolver:node-list:item"]'); + public nodeListNodeLinkIcons(): ReactWrapper { + return this.domNodes('[data-test-subj="resolver:node-list:node-link:icon"]'); } /** - * The element containing the details for the selected node. + * Link rendered in the breadcrumbs of the node detail view. Takes the user to the node list. */ - public nodeDetailElement(): ReactWrapper { - return this.domNodes('[data-test-subj="resolver:node-detail"]'); + public nodeDetailBreadcrumbNodeListLink(): ReactWrapper { + return this.domNodes('[data-test-subj="resolver:node-detail:breadcrumbs:node-list-link"]'); } /** - * The details of the selected node are shown in a description list. This returns the title elements of the description list. + * The title element for the node detail view. */ - private nodeDetailEntryTitle(): ReactWrapper { - return this.domNodes('[data-test-subj="resolver:node-detail:entry-title"]'); + public nodeDetailViewTitle(): ReactWrapper { + return this.domNodes('[data-test-subj="resolver:node-detail:title"]'); } /** - * The details of the selected node are shown in a description list. This returns the description elements of the description list. + * The icon element for the node detail title. */ - private nodeDetailEntryDescription(): ReactWrapper { - return this.domNodes('[data-test-subj="resolver:node-detail:entry-description"]'); + public nodeDetailViewTitleIcon(): ReactWrapper { + return this.domNodes('[data-test-subj="resolver:node-detail:title-icon"]'); } /** @@ -253,8 +270,14 @@ export class Simulator { * The titles and descriptions (as text) from the node detail panel. */ public nodeDetailDescriptionListEntries(): Array<[string, string]> { - const titles = this.nodeDetailEntryTitle(); - const descriptions = this.nodeDetailEntryDescription(); + /** + * The details of the selected node are shown in a description list. This returns the title elements of the description list. + */ + const titles = this.domNodes('[data-test-subj="resolver:node-detail:entry-title"]'); + /** + * The details of the selected node are shown in a description list. This returns the description elements of the description list. + */ + const descriptions = this.domNodes('[data-test-subj="resolver:node-detail:entry-description"]'); const entries: Array<[string, string]> = []; for (let index = 0; index < Math.min(titles.length, descriptions.length); index++) { const title = titles.at(index).text(); diff --git a/x-pack/plugins/security_solution/public/resolver/test_utilities/url_search.ts b/x-pack/plugins/security_solution/public/resolver/test_utilities/url_search.ts new file mode 100644 index 00000000000000..1a26e29d22da7d --- /dev/null +++ b/x-pack/plugins/security_solution/public/resolver/test_utilities/url_search.ts @@ -0,0 +1,26 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +interface Options { + /** + * The entity_id of the selected node. + */ + selectedEntityID?: string; +} + +/** + * Calculate the expected URL search based on options. + */ +export function urlSearch(resolverComponentInstanceID: string, options?: Options): string { + if (!options) { + return ''; + } + const params = new URLSearchParams(); + if (options.selectedEntityID !== undefined) { + params.set(`resolver-${resolverComponentInstanceID}-id`, options.selectedEntityID); + } + return params.toString(); +} diff --git a/x-pack/plugins/security_solution/public/resolver/view/assets.tsx b/x-pack/plugins/security_solution/public/resolver/view/assets.tsx index fc4a9daf17ad19..6962d300f70726 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/assets.tsx +++ b/x-pack/plugins/security_solution/public/resolver/view/assets.tsx @@ -4,6 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +/* eslint-disable react/display-name */ + import React, { memo } from 'react'; import euiThemeAmsterdamDark from '@elastic/eui/dist/eui_theme_amsterdam_dark.json'; import euiThemeAmsterdamLight from '@elastic/eui/dist/eui_theme_amsterdam_light.json'; @@ -11,7 +13,7 @@ import { htmlIdGenerator, ButtonColor } from '@elastic/eui'; import styled from 'styled-components'; import { i18n } from '@kbn/i18n'; import { useUiSetting } from '../../common/lib/kibana'; -import { DEFAULT_DARK_MODE } from '../../../common/constants'; +import { DEFAULT_DARK_MODE as defaultDarkMode } from '../../../common/constants'; import { ResolverProcessType } from '../types'; type ResolverColorNames = @@ -141,8 +143,6 @@ const PaintServers = memo(({ isDarkMode }: { isDarkMode: boolean }) => ( )); -PaintServers.displayName = 'PaintServers'; - /** * Ids of symbols to be linked by elements */ @@ -376,8 +376,6 @@ const SymbolsAndShapes = memo(({ isDarkMode }: { isDarkMode: boolean }) => ( )); -SymbolsAndShapes.displayName = 'SymbolsAndShapes'; - /** * This `` element is used to define the reusable assets for the Resolver * It confers several advantages, including but not limited to: @@ -386,7 +384,7 @@ SymbolsAndShapes.displayName = 'SymbolsAndShapes'; * 3. `` elements can be handled by compositor (faster) */ const SymbolDefinitionsComponent = memo(({ className }: { className?: string }) => { - const isDarkMode = useUiSetting(DEFAULT_DARK_MODE); + const isDarkMode = useUiSetting(defaultDarkMode); return ( @@ -397,8 +395,6 @@ const SymbolDefinitionsComponent = memo(({ className }: { className?: string }) ); }); -SymbolDefinitionsComponent.displayName = 'SymbolDefinitions'; - export const SymbolDefinitions = styled(SymbolDefinitionsComponent)` position: absolute; left: 100%; @@ -424,7 +420,7 @@ export const useResolverTheme = (): { nodeAssets: NodeStyleMap; cubeAssetsForNode: (isProcessTerimnated: boolean, isProcessTrigger: boolean) => NodeStyleConfig; } => { - const isDarkMode = useUiSetting(DEFAULT_DARK_MODE); + const isDarkMode = useUiSetting(defaultDarkMode); const theme = isDarkMode ? euiThemeAmsterdamDark : euiThemeAmsterdamLight; const getThemedOption = (lightOption: string, darkOption: string): string => { diff --git a/x-pack/plugins/security_solution/public/resolver/view/clickthrough.test.tsx b/x-pack/plugins/security_solution/public/resolver/view/clickthrough.test.tsx index 98ea235d3524fe..296e5b253c0b91 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/clickthrough.test.tsx +++ b/x-pack/plugins/security_solution/public/resolver/view/clickthrough.test.tsx @@ -71,8 +71,9 @@ describe('Resolver, when analyzing a tree that has no ancestors and 2 children', }); }); - it(`should show the node list`, async () => { - await expect(simulator.map(() => simulator.nodeListElement().length)).toYieldEqualTo(1); + it(`should show links to the 3 nodes (with icons) in the node list.`, async () => { + await expect(simulator.map(() => simulator.nodeListNodeLinkText().length)).toYieldEqualTo(3); + await expect(simulator.map(() => simulator.nodeListNodeLinkIcons().length)).toYieldEqualTo(3); }); describe("when the second child node's first button has been clicked", () => { @@ -152,5 +153,20 @@ describe('Resolver, when analyzing a tree that has two related events for the or relatedEventButtons: 1, }); }); + describe('when the related events button is clicked', () => { + beforeEach(async () => { + const button = await simulator.resolveWrapper(() => + simulator.processNodeRelatedEventButton(entityIDs.origin) + ); + if (button) { + button.simulate('click'); + } + }); + it('should open the submenu', async () => { + await expect( + simulator.map(() => simulator.processNodeSubmenuItems().map((node) => node.text())) + ).toYieldEqualTo(['2 registry']); + }); + }); }); }); diff --git a/x-pack/plugins/security_solution/public/resolver/view/map.tsx b/x-pack/plugins/security_solution/public/resolver/view/map.tsx deleted file mode 100644 index bbff2388af8b71..00000000000000 --- a/x-pack/plugins/security_solution/public/resolver/view/map.tsx +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -/* eslint-disable react/display-name */ - -import React, { useContext } from 'react'; -import { useSelector } from 'react-redux'; -import { useEffectOnce } from 'react-use'; -import { EuiLoadingSpinner } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; -import * as selectors from '../store/selectors'; -import { EdgeLine } from './edge_line'; -import { GraphControls } from './graph_controls'; -import { ProcessEventDot } from './process_event_dot'; -import { useCamera } from './use_camera'; -import { SymbolDefinitions, useResolverTheme } from './assets'; -import { useStateSyncingActions } from './use_state_syncing_actions'; -import { useResolverQueryParams } from './use_resolver_query_params'; -import { StyledMapContainer, StyledPanel, GraphContainer } from './styles'; -import { entityIDSafeVersion } from '../../../common/endpoint/models/event'; -import { SideEffectContext } from './side_effect_context'; - -/** - * The highest level connected Resolver component. Needs a `Provider` in its ancestry to work. - */ -export const ResolverMap = React.memo(function ({ - className, - databaseDocumentID, - resolverComponentInstanceID, -}: { - /** - * Used by `styled-components`. - */ - className?: string; - /** - * The `_id` value of an event in ES. - * Used as the origin of the Resolver graph. - */ - databaseDocumentID?: string; - /** - * A string literal describing where in the app resolver is located, - * used to prevent collisions in things like query params - */ - resolverComponentInstanceID: string; -}) { - /** - * This is responsible for dispatching actions that include any external data. - * `databaseDocumentID` - */ - useStateSyncingActions({ databaseDocumentID, resolverComponentInstanceID }); - - const { timestamp } = useContext(SideEffectContext); - - // use this for the entire render in order to keep things in sync - const timeAtRender = timestamp(); - - const { processNodePositions, connectingEdgeLineSegments } = useSelector( - selectors.visibleNodesAndEdgeLines - )(timeAtRender); - const terminatedProcesses = useSelector(selectors.terminatedProcesses); - const { projectionMatrix, ref, onMouseDown } = useCamera(); - const isLoading = useSelector(selectors.isLoading); - const hasError = useSelector(selectors.hasError); - const activeDescendantId = useSelector(selectors.ariaActiveDescendant); - const { colorMap } = useResolverTheme(); - const { cleanUpQueryParams } = useResolverQueryParams(); - - useEffectOnce(() => { - return () => cleanUpQueryParams(); - }); - - return ( - - {isLoading ? ( -
- -
- ) : hasError ? ( -
-
- {' '} - -
-
- ) : ( - - {connectingEdgeLineSegments.map(({ points: [startPosition, endPosition], metadata }) => ( - - ))} - {[...processNodePositions].map(([processEvent, position]) => { - const processEntityId = entityIDSafeVersion(processEvent); - return ( - - ); - })} - - )} - - - - - ); -}); diff --git a/x-pack/plugins/security_solution/public/resolver/view/panel.test.tsx b/x-pack/plugins/security_solution/public/resolver/view/panel.test.tsx index 78e5fd79bea134..4d391a6c9ce59c 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/panel.test.tsx +++ b/x-pack/plugins/security_solution/public/resolver/view/panel.test.tsx @@ -4,47 +4,143 @@ * you may not use this file except in compliance with the Elastic License. */ +import { createMemoryHistory, History as HistoryPackageHistoryInterface } from 'history'; + import { noAncestorsTwoChildren } from '../data_access_layer/mocks/no_ancestors_two_children'; import { Simulator } from '../test_utilities/simulator'; // Extend jest with a custom matcher import '../test_utilities/extend_jest'; +import { urlSearch } from '../test_utilities/url_search'; + +// the resolver component instance ID, used by the react code to distinguish piece of global state from those used by other resolver instances +const resolverComponentInstanceID = 'resolverComponentInstanceID'; -describe('Resolver: when analyzing a tree with no ancestors and two children', () => { - let simulator: Simulator; - let databaseDocumentID: string; +describe(`Resolver: when analyzing a tree with no ancestors and two children, and when the component instance ID is ${resolverComponentInstanceID}`, () => { + /** + * Get (or lazily create and get) the simulator. + */ + let simulator: () => Simulator; + /** lazily populated by `simulator`. */ + let simulatorInstance: Simulator | undefined; + let memoryHistory: HistoryPackageHistoryInterface; - // the resolver component instance ID, used by the react code to distinguish piece of global state from those used by other resolver instances - const resolverComponentInstanceID = 'resolverComponentInstanceID'; + // node IDs used by the generator + let entityIDs: { + origin: string; + firstChild: string; + secondChild: string; + }; - beforeEach(async () => { + beforeEach(() => { // create a mock data access layer const { metadata: dataAccessLayerMetadata, dataAccessLayer } = noAncestorsTwoChildren(); - // save a reference to the `_id` supported by the mock data layer - databaseDocumentID = dataAccessLayerMetadata.databaseDocumentID; + entityIDs = dataAccessLayerMetadata.entityIDs; + + memoryHistory = createMemoryHistory(); // create a resolver simulator, using the data access layer and an arbitrary component instance ID - simulator = new Simulator({ databaseDocumentID, dataAccessLayer, resolverComponentInstanceID }); + simulator = () => { + if (simulatorInstance) { + return simulatorInstance; + } else { + simulatorInstance = new Simulator({ + databaseDocumentID: dataAccessLayerMetadata.databaseDocumentID, + dataAccessLayer, + resolverComponentInstanceID, + history: memoryHistory, + }); + return simulatorInstance; + } + }; }); - it('should show the node list', async () => { - await expect(simulator.map(() => simulator.nodeListElement().length)).toYieldEqualTo(1); + afterEach(() => { + simulatorInstance = undefined; }); - it('should have 3 nodes in the node list', async () => { - await expect(simulator.map(() => simulator.nodeListItems().length)).toYieldEqualTo(3); + const queryStringWithOriginSelected = urlSearch(resolverComponentInstanceID, { + selectedEntityID: 'origin', }); - describe('when there is an item in the node list and it has been clicked', () => { + + describe(`when the URL query string is ${queryStringWithOriginSelected}`, () => { + beforeEach(() => { + memoryHistory.push({ + search: queryStringWithOriginSelected, + }); + }); + it('should show the node details for the origin', async () => { + await expect( + simulator().map(() => { + const titleWrapper = simulator().nodeDetailViewTitle(); + const titleIconWrapper = simulator().nodeDetailViewTitleIcon(); + return { + title: titleWrapper.exists() ? titleWrapper.text() : null, + titleIcon: titleIconWrapper.exists() ? titleIconWrapper.text() : null, + detailEntries: simulator().nodeDetailDescriptionListEntries(), + }; + }) + ).toYieldEqualTo({ + title: 'c', + titleIcon: 'Running Process', + detailEntries: [ + ['process.executable', 'executable'], + ['process.pid', '0'], + ['user.name', 'user.name'], + ['user.domain', 'user.domain'], + ['process.parent.pid', '0'], + ['process.hash.md5', 'hash.md5'], + ['process.args', 'args'], + ], + }); + }); + }); + + const queryStringWithFirstChildSelected = urlSearch(resolverComponentInstanceID, { + selectedEntityID: 'firstChild', + }); + + describe(`when the URL query string is ${queryStringWithFirstChildSelected}`, () => { + beforeEach(() => { + memoryHistory.push({ + search: queryStringWithFirstChildSelected, + }); + }); + it('should show the node details for the first child', async () => { + await expect( + simulator().map(() => simulator().nodeDetailDescriptionListEntries()) + ).toYieldEqualTo([ + ['process.executable', 'executable'], + ['process.pid', '1'], + ['user.name', 'user.name'], + ['user.domain', 'user.domain'], + ['process.parent.pid', '0'], + ['process.hash.md5', 'hash.md5'], + ['process.args', 'args'], + ]); + }); + }); + + it('should have 3 nodes (with icons) in the node list', async () => { + await expect(simulator().map(() => simulator().nodeListNodeLinkText().length)).toYieldEqualTo( + 3 + ); + await expect(simulator().map(() => simulator().nodeListNodeLinkIcons().length)).toYieldEqualTo( + 3 + ); + }); + + describe('when there is an item in the node list and its text has been clicked', () => { beforeEach(async () => { - const nodeListItems = await simulator.resolveWrapper(() => simulator.nodeListItems()); - expect(nodeListItems && nodeListItems.length).toBeTruthy(); - if (nodeListItems) { - nodeListItems.first().find('button').simulate('click'); + const nodeLinks = await simulator().resolveWrapper(() => simulator().nodeListNodeLinkText()); + expect(nodeLinks).toBeTruthy(); + if (nodeLinks) { + nodeLinks.first().simulate('click'); } }); it('should show the details for the first node', async () => { await expect( - simulator.map(() => simulator.nodeDetailDescriptionListEntries()) + simulator().map(() => simulator().nodeDetailDescriptionListEntries()) ).toYieldEqualTo([ ['process.executable', 'executable'], ['process.pid', '0'], @@ -55,5 +151,29 @@ describe('Resolver: when analyzing a tree with no ancestors and two children', ( ['process.args', 'args'], ]); }); + it("should have the first node's ID in the query string", async () => { + await expect(simulator().map(() => simulator().queryStringValues())).toYieldEqualTo({ + selectedNode: [entityIDs.origin], + }); + }); + describe('and when the node list link has been clicked', () => { + beforeEach(async () => { + const nodeListLink = await simulator().resolveWrapper(() => + simulator().nodeDetailBreadcrumbNodeListLink() + ); + if (nodeListLink) { + nodeListLink.simulate('click'); + } + }); + it('should show the list of nodes with links to each node', async () => { + await expect( + simulator().map(() => { + return simulator() + .nodeListNodeLinkText() + .map((node) => node.text()); + }) + ).toYieldEqualTo(['c', 'd', 'e']); + }); + }); }); }); diff --git a/x-pack/plugins/security_solution/public/resolver/view/panels/cube_for_process.tsx b/x-pack/plugins/security_solution/public/resolver/view/panels/cube_for_process.tsx index 0d8f65b4e39e62..b7c8ed0dfd7db7 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/panels/cube_for_process.tsx +++ b/x-pack/plugins/security_solution/public/resolver/view/panels/cube_for_process.tsx @@ -4,42 +4,55 @@ * you may not use this file except in compliance with the Elastic License. */ +import styled from 'styled-components'; + +import { i18n } from '@kbn/i18n'; + +/* eslint-disable react/display-name */ + import React, { memo } from 'react'; import { useResolverTheme } from '../assets'; /** - * During user testing, one user indicated they wanted to see stronger visual relationships between - * Nodes on the graph and what's in the table. Using the same symbol in both places (as below) could help with that. + * Icon representing a process node. */ -export const CubeForProcess = memo(function CubeForProcess({ - isProcessTerminated, +export const CubeForProcess = memo(function ({ + running, + 'data-test-subj': dataTestSubj, }: { - isProcessTerminated: boolean; + 'data-test-subj'?: string; + /** + * True if the process represented by the node is still running. + */ + running: boolean; }) { const { cubeAssetsForNode } = useResolverTheme(); - const { cubeSymbol, descriptionText } = cubeAssetsForNode(isProcessTerminated, false); + const { cubeSymbol } = cubeAssetsForNode(!running, false); return ( - <> - - {descriptionText} - - - + + + {i18n.translate('xpack.securitySolution.resolver.node_icon', { + defaultMessage: '{running, select, true {Running Process} false {Terminated Process}}', + values: { running }, + })} + + + ); }); + +const StyledSVG = styled.svg` + position: relative; + top: 0.4em; + margin-right: 0.25em; +`; diff --git a/x-pack/plugins/security_solution/public/resolver/view/panels/index.tsx b/x-pack/plugins/security_solution/public/resolver/view/panels/index.tsx index 7e7e8b757baf75..b3c4eefe5fae78 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/panels/index.tsx +++ b/x-pack/plugins/security_solution/public/resolver/view/panels/index.tsx @@ -220,7 +220,7 @@ PanelContent.displayName = 'PanelContent'; export const Panel = memo(function Event({ className }: { className?: string }) { return ( - + ); diff --git a/x-pack/plugins/security_solution/public/resolver/view/panels/process_details.tsx b/x-pack/plugins/security_solution/public/resolver/view/panels/process_details.tsx index 112a3400c4947a..adfcc4cc44d1f7 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/panels/process_details.tsx +++ b/x-pack/plugins/security_solution/public/resolver/view/panels/process_details.tsx @@ -129,6 +129,7 @@ export const ProcessDetails = memo(function ProcessDetails({ defaultMessage: 'Events', } ), + 'data-test-subj': 'resolver:node-detail:breadcrumbs:node-list-link', onClick: () => { pushToQueryParams({ crumbId: '', crumbEvent: '' }); }, @@ -155,20 +156,23 @@ export const ProcessDetails = memo(function ProcessDetails({ return cubeAssetsForNode(isProcessTerminated, false); }, [processEvent, cubeAssetsForNode, isProcessTerminated]); - const titleId = useMemo(() => htmlIdGenerator('resolverTable')(), []); + const titleID = useMemo(() => htmlIdGenerator('resolverTable')(), []); return ( <> -

- - {processName} +

+ + {processName}

- {descriptionText} + {descriptionText} diff --git a/x-pack/plugins/security_solution/public/resolver/view/panels/process_list_with_counts.tsx b/x-pack/plugins/security_solution/public/resolver/view/panels/process_list_with_counts.tsx index 11f005f8acbcd9..1be4b4b0552437 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/panels/process_list_with_counts.tsx +++ b/x-pack/plugins/security_solution/public/resolver/view/panels/process_list_with_counts.tsx @@ -111,8 +111,11 @@ export const ProcessListWithCounts = memo(function ProcessListWithCounts({ }); }} > - - {name} + + {name} ); }, @@ -150,18 +153,10 @@ export const ProcessListWithCounts = memo(function ProcessListWithCounts({ const processTableView: ProcessTableView[] = useMemo( () => [...processNodePositions.keys()].map((processEvent) => { - let dateTime: Date | undefined; - const eventTime = event.timestampSafeVersion(processEvent); const name = event.processNameSafeVersion(processEvent); - if (eventTime) { - const date = new Date(eventTime); - if (isFinite(date.getTime())) { - dateTime = date; - } - } return { name, - timestamp: dateTime, + timestamp: event.timestampAsDateSafeVersion(processEvent), event: processEvent, }; }), @@ -172,12 +167,9 @@ export const ProcessListWithCounts = memo(function ProcessListWithCounts({ const crumbs = useMemo(() => { return [ { - text: i18n.translate( - 'xpack.securitySolution.endpoint.resolver.panel.processListWithCounts.events', - { - defaultMessage: 'All Process Events', - } - ), + text: i18n.translate('xpack.securitySolution.resolver.panel.nodeList.title', { + defaultMessage: 'All Process Events', + }), onClick: () => {}, }, ]; diff --git a/x-pack/plugins/security_solution/public/resolver/view/submenu.tsx b/x-pack/plugins/security_solution/public/resolver/view/submenu.tsx index 7f0ba244146fd6..359a4e2dafd2ea 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/submenu.tsx +++ b/x-pack/plugins/security_solution/public/resolver/view/submenu.tsx @@ -4,8 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ +/* eslint-disable no-duplicate-imports */ + +/* eslint-disable react/display-name */ + import { i18n } from '@kbn/i18n'; -import React, { ReactNode, useState, useMemo, useCallback, useRef, useLayoutEffect } from 'react'; +import React, { useState, useMemo, useCallback, useRef, useLayoutEffect } from 'react'; import { EuiI18nNumber, EuiSelectable, @@ -15,6 +19,7 @@ import { htmlIdGenerator, } from '@elastic/eui'; import styled from 'styled-components'; +import { EuiSelectableOption } from '@elastic/eui'; import { Matrix3 } from '../types'; /** @@ -59,21 +64,21 @@ const OptionList = React.memo( subMenuOptions: ResolverSubmenuOptionList; isLoading: boolean; }) => { - const [options, setOptions] = useState(() => + const [options, setOptions] = useState(() => typeof subMenuOptions !== 'object' ? [] - : subMenuOptions.map((opt: ResolverSubmenuOption): { - label: string; - prepend?: ReactNode; - } => { - return opt.prefix + : subMenuOptions.map((option: ResolverSubmenuOption) => { + const dataTestSubj = 'resolver:map:node-submenu-item'; + return option.prefix ? { - label: opt.optionTitle, - prepend: {opt.prefix} , + label: option.optionTitle, + prepend: {option.prefix} , + 'data-test-subj': dataTestSubj, } : { - label: opt.optionTitle, + label: option.optionTitle, prepend: , + 'data-test-subj': dataTestSubj, }; }) ); @@ -88,11 +93,10 @@ const OptionList = React.memo( }, {}); }, [subMenuOptions]); - type ChangeOptions = Array<{ label: string; prepend?: ReactNode; checked?: string }>; const selectableProps = useMemo(() => { return { listProps: { showIcons: true, bordered: true }, - onChange: (newOptions: ChangeOptions) => { + onChange: (newOptions: EuiSelectableOption[]) => { const selectedOption = newOptions.find((opt) => opt.checked === 'on'); if (selectedOption) { const { label } = selectedOption; @@ -119,8 +123,6 @@ const OptionList = React.memo( } ); -OptionList.displayName = 'OptionList'; - /** * A Submenu to be displayed in one of two forms: * 1) Provided a collection of `optionsWithActions`: it will call `menuAction` then - if and when menuData becomes available - display each item with an optional prefix and call the supplied action for the options when that option is clicked. @@ -259,8 +261,6 @@ const NodeSubMenuComponents = React.memo( } ); -NodeSubMenuComponents.displayName = 'NodeSubMenu'; - export const NodeSubMenu = styled(NodeSubMenuComponents)` margin: 2px 0 0 0; padding: 0; diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index c796aacda10a04..f2aeed63d6eea2 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -4283,7 +4283,6 @@ "visTypeVega.vegaParser.dataExceedsSomeParamsUseTimesLimitErrorMessage": "データには {urlParam}、{valuesParam}、 {sourceParam} の内複数を含めることができません", "visTypeVega.vegaParser.hostConfigIsDeprecatedWarningMessage": "{deprecatedConfigName} は廃止されました。代わりに {newConfigName} を使用してください。", "visTypeVega.vegaParser.hostConfigValueTypeErrorMessage": "{configName} が含まれている場合、オブジェクトでなければなりません", - "visTypeVega.vegaParser.inputSpecDoesNotSpecifySchemaWarningMessage": "インプット仕様で {schemaParam} が指定されていないため、デフォルトで {defaultSchema} になります", "visTypeVega.vegaParser.invalidVegaSpecErrorMessage": "無効な Vega 仕様", "visTypeVega.vegaParser.kibanaConfigValueTypeErrorMessage": "{configName} が含まれている場合、オブジェクトでなければなりません", "visTypeVega.vegaParser.mapStyleValueTypeWarningMessage": "{mapStyleConfigName} は {mapStyleConfigFirstAllowedValue} か {mapStyleConfigSecondAllowedValue} のどちらかです", @@ -9837,11 +9836,8 @@ "xpack.ingestPipelines.requestFlyout.descriptionText": "このElasticsearchリクエストは、このパイプラインを作成または更新します。", "xpack.ingestPipelines.requestFlyout.namedTitle": "「{name}」のリクエスト", "xpack.ingestPipelines.requestFlyout.unnamedTitle": "リクエスト", - "xpack.ingestPipelines.settingsFormFlyout.title": "プロセッサーの構成", "xpack.ingestPipelines.settingsFormOnFailureFlyout.addButtonLabel": "追加", "xpack.ingestPipelines.settingsFormOnFailureFlyout.cancelButtonLabel": "キャンセル", - "xpack.ingestPipelines.settingsFormOnFailureFlyout.title": "エラープロセッサーの構成", - "xpack.ingestPipelines.settingsFormOnFailureFlyout.updateButtonLabel": "更新", "xpack.ingestPipelines.tabs.documentsTabTitle": "ドキュメント", "xpack.ingestPipelines.tabs.outputTabTitle": "アウトプット", "xpack.ingestPipelines.testPipelineFlyout.documentsForm.documentsFieldLabel": "ドキュメント", @@ -16236,65 +16232,65 @@ "xpack.securitySolution.editDataProvider.valuePlaceholder": "値", "xpack.securitySolution.emptyMessage": "Elastic セキュリティは無料かつオープンのElastic SIEMに、Elastic Endpointを搭載。脅威の防御と検知、脅威への対応を支援します。開始するには、セキュリティソリューション関連データをElastic Stackに追加する必要があります。詳細については、ご覧ください ", "xpack.securitySolution.emptyString.emptyStringDescription": "空の文字列", - "xpack.securitySolution.endpoint.host.details.endpointVersion": "エンドポイントバージョン", - "xpack.securitySolution.endpoint.host.details.errorBody": "フライアウトを終了して、利用可能なホストを選択してください。", - "xpack.securitySolution.endpoint.host.details.errorTitle": "ホストが見つかりませんでした", - "xpack.securitySolution.endpoint.host.details.hostname": "ホスト名", - "xpack.securitySolution.endpoint.host.details.ipAddress": "IP アドレス", - "xpack.securitySolution.endpoint.host.details.lastSeen": "前回の認識", - "xpack.securitySolution.endpoint.host.details.linkToIngestTitle": "ポリシーの再割り当て", - "xpack.securitySolution.endpoint.host.details.os": "OS", - "xpack.securitySolution.endpoint.host.details.policy": "ポリシー", - "xpack.securitySolution.endpoint.host.details.policyStatus": "ポリシーステータス", - "xpack.securitySolution.endpoint.host.details.policyStatusValue": "{policyStatus, select, success {成功} warning {警告} failure {失敗} other {不明}}", - "xpack.securitySolution.endpoint.host.policyResponse.backLinkTitle": "エンドポイント詳細", - "xpack.securitySolution.endpoint.host.policyResponse.title": "ポリシー応答", - "xpack.securitySolution.endpoint.hostDetails.noPolicyResponse": "ポリシー応答がありません", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_dns_events": "DNSイベントの構成", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_elasticsearch_connection": "Elastic Search接続の構成", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_file_events": "ファイルイベントの構成", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_imageload_events": "画像読み込みイベントの構成", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_kernel": "カーネルの構成", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_logging": "ロギングの構成", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_malware": "マルウェアの構成", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_network_events": "ネットワークイベントの構成", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_process_events": "プロセスイベントの構成", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_registry_events": "レジストリイベントの構成", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_security_events": "セキュリティイベントの構成", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.connect_kernel": "カーネルを接続", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_async_image_load_events": "非同期画像読み込みイベントを検出", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_file_open_events": "ファイルオープンイベントを検出", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_file_write_events": "ファイル書き込みイベントを検出", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_network_events": "ネットワークイベントを検出", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_process_events": "プロセスイベントを検出", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_registry_events": "レジストリイベントを検出", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_sync_image_load_events": "同期画像読み込みイベントを検出", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.download_global_artifacts": "グローバルアーチファクトをダウンロード", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.download_user_artifacts": "ユーザーアーチファクトをダウンロード", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.events": "イベント", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.failed": "失敗", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.load_config": "構成の読み込み", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.load_malware_model": "マルウェアモデルの読み込み", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.logging": "ログ", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.malware": "マルウェア", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.read_elasticsearch_config": "Elasticsearch構成を読み取る", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.read_events_config": "イベント構成を読み取る", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.read_kernel_config": "カーネル構成を読み取る", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.read_logging_config": "ロギング構成を読み取る", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.read_malware_config": "マルウェア構成を読み取る", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.streaming": "ストリーム中…", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.success": "成功", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.warning": "警告", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.workflow": "ワークフロー", - "xpack.securitySolution.endpoint.hostList.beta": "ベータ", - "xpack.securitySolution.endpoint.hostList.loadingPolicies": "ポリシー構成を読み込んでいます…", - "xpack.securitySolution.endpoint.hostList.noEndpointsInstructions": "セキュリティポリシーを作成しました。以下のステップに従い、エージェントでElastic Endpoint Security機能を有効にする必要があります。", - "xpack.securitySolution.endpoint.hostList.noEndpointsPrompt": "エージェントでElastic Endpoint Securityを有効にする", - "xpack.securitySolution.endpoint.hostList.noPolicies": "ポリシーがありません。", - "xpack.securitySolution.endpoint.hostList.stepOne": "既存のポリシーは以下のリストのとおりです。これは後から変更できます。", - "xpack.securitySolution.endpoint.hostList.stepOneTitle": "ホストの保護で使用するポリシーを選択", - "xpack.securitySolution.endpoint.hostList.stepTwo": "開始するために必要なコマンドが提供されます。", - "xpack.securitySolution.endpoint.hostList.stepTwoTitle": "Ingest Manager経由でEndpoint Securityによって有効にされたエージェントを登録", + "xpack.securitySolution.endpoint.details.endpointVersion": "エンドポイントバージョン", + "xpack.securitySolution.endpoint.details.errorBody": "フライアウトを終了して、利用可能なホストを選択してください。", + "xpack.securitySolution.endpoint.details.errorTitle": "ホストが見つかりませんでした", + "xpack.securitySolution.endpoint.details.hostname": "ホスト名", + "xpack.securitySolution.endpoint.details.ipAddress": "IP アドレス", + "xpack.securitySolution.endpoint.details.lastSeen": "前回の認識", + "xpack.securitySolution.endpoint.details.linkToIngestTitle": "ポリシーの再割り当て", + "xpack.securitySolution.endpoint.details.os": "OS", + "xpack.securitySolution.endpoint.details.policy": "ポリシー", + "xpack.securitySolution.endpoint.details.policyStatus": "ポリシーステータス", + "xpack.securitySolution.endpoint.details.policyStatusValue": "{policyStatus, select, success {成功} warning {警告} failure {失敗} other {不明}}", + "xpack.securitySolution.endpoint.policyResponse.backLinkTitle": "エンドポイント詳細", + "xpack.securitySolution.endpoint.policyResponse.title": "ポリシー応答", + "xpack.securitySolution.endpoint.details.noPolicyResponse": "ポリシー応答がありません", + "xpack.securitySolution.endpoint.details.policyResponse.configure_dns_events": "DNSイベントの構成", + "xpack.securitySolution.endpoint.details.policyResponse.configure_elasticsearch_connection": "Elastic Search接続の構成", + "xpack.securitySolution.endpoint.details.policyResponse.configure_file_events": "ファイルイベントの構成", + "xpack.securitySolution.endpoint.details.policyResponse.configure_imageload_events": "画像読み込みイベントの構成", + "xpack.securitySolution.endpoint.details.policyResponse.configure_kernel": "カーネルの構成", + "xpack.securitySolution.endpoint.details.policyResponse.configure_logging": "ロギングの構成", + "xpack.securitySolution.endpoint.details.policyResponse.configure_malware": "マルウェアの構成", + "xpack.securitySolution.endpoint.details.policyResponse.configure_network_events": "ネットワークイベントの構成", + "xpack.securitySolution.endpoint.details.policyResponse.configure_process_events": "プロセスイベントの構成", + "xpack.securitySolution.endpoint.details.policyResponse.configure_registry_events": "レジストリイベントの構成", + "xpack.securitySolution.endpoint.details.policyResponse.configure_security_events": "セキュリティイベントの構成", + "xpack.securitySolution.endpoint.details.policyResponse.connect_kernel": "カーネルを接続", + "xpack.securitySolution.endpoint.details.policyResponse.detect_async_image_load_events": "非同期画像読み込みイベントを検出", + "xpack.securitySolution.endpoint.details.policyResponse.detect_file_open_events": "ファイルオープンイベントを検出", + "xpack.securitySolution.endpoint.details.policyResponse.detect_file_write_events": "ファイル書き込みイベントを検出", + "xpack.securitySolution.endpoint.details.policyResponse.detect_network_events": "ネットワークイベントを検出", + "xpack.securitySolution.endpoint.details.policyResponse.detect_process_events": "プロセスイベントを検出", + "xpack.securitySolution.endpoint.details.policyResponse.detect_registry_events": "レジストリイベントを検出", + "xpack.securitySolution.endpoint.details.policyResponse.detect_sync_image_load_events": "同期画像読み込みイベントを検出", + "xpack.securitySolution.endpoint.details.policyResponse.download_global_artifacts": "グローバルアーチファクトをダウンロード", + "xpack.securitySolution.endpoint.details.policyResponse.download_user_artifacts": "ユーザーアーチファクトをダウンロード", + "xpack.securitySolution.endpoint.details.policyResponse.events": "イベント", + "xpack.securitySolution.endpoint.details.policyResponse.failed": "失敗", + "xpack.securitySolution.endpoint.details.policyResponse.load_config": "構成の読み込み", + "xpack.securitySolution.endpoint.details.policyResponse.load_malware_model": "マルウェアモデルの読み込み", + "xpack.securitySolution.endpoint.details.policyResponse.logging": "ログ", + "xpack.securitySolution.endpoint.details.policyResponse.malware": "マルウェア", + "xpack.securitySolution.endpoint.details.policyResponse.read_elasticsearch_config": "Elasticsearch構成を読み取る", + "xpack.securitySolution.endpoint.details.policyResponse.read_events_config": "イベント構成を読み取る", + "xpack.securitySolution.endpoint.details.policyResponse.read_kernel_config": "カーネル構成を読み取る", + "xpack.securitySolution.endpoint.details.policyResponse.read_logging_config": "ロギング構成を読み取る", + "xpack.securitySolution.endpoint.details.policyResponse.read_malware_config": "マルウェア構成を読み取る", + "xpack.securitySolution.endpoint.details.policyResponse.streaming": "ストリーム中…", + "xpack.securitySolution.endpoint.details.policyResponse.success": "成功", + "xpack.securitySolution.endpoint.details.policyResponse.warning": "警告", + "xpack.securitySolution.endpoint.details.policyResponse.workflow": "ワークフロー", + "xpack.securitySolution.endpoint.list.beta": "ベータ", + "xpack.securitySolution.endpoint.list.loadingPolicies": "ポリシー構成を読み込んでいます…", + "xpack.securitySolution.endpoint.list.noEndpointsInstructions": "セキュリティポリシーを作成しました。以下のステップに従い、エージェントでElastic Endpoint Security機能を有効にする必要があります。", + "xpack.securitySolution.endpoint.list.noEndpointsPrompt": "エージェントでElastic Endpoint Securityを有効にする", + "xpack.securitySolution.endpoint.list.noPolicies": "ポリシーがありません。", + "xpack.securitySolution.endpoint.list.stepOne": "既存のポリシーは以下のリストのとおりです。これは後から変更できます。", + "xpack.securitySolution.endpoint.list.stepOneTitle": "ホストの保護で使用するポリシーを選択", + "xpack.securitySolution.endpoint.list.stepTwo": "開始するために必要なコマンドが提供されます。", + "xpack.securitySolution.endpoint.list.stepTwoTitle": "Ingest Manager経由でEndpoint Securityによって有効にされたエージェントを登録", "xpack.securitySolution.endpoint.ingestManager.createPackageConfig.endpointConfiguration": "このエージェント構成を使用するすべてのエージェントは基本ポリシーを使用します。セキュリティアプリでこのポリシーを変更できます。Fleetはこれらの変更をエージェントにデプロイします。", "xpack.securitySolution.endpoint.ingestToastMessage": "Ingest Managerが設定中に失敗しました。", "xpack.securitySolution.endpoint.ingestToastTitle": "アプリを初期化できませんでした", @@ -16384,7 +16380,7 @@ "xpack.securitySolution.endpoint.resolver.panel.processEventListByType.eventDescriptiveName": "{descriptor} {subject}", "xpack.securitySolution.endpoint.resolver.panel.processEventListByType.events": "イベント", "xpack.securitySolution.endpoint.resolver.panel.processEventListByType.wait": "イベントを待機しています...", - "xpack.securitySolution.endpoint.resolver.panel.processListWithCounts.events": "すべてのプロセスイベント", + "xpack.securitySolution.resolver.panel.nodeList.title": "すべてのプロセスイベント", "xpack.securitySolution.endpoint.resolver.panel.relatedCounts.numberOfEventsInCrumb": "{totalCount}件のイベント", "xpack.securitySolution.endpoint.resolver.panel.relatedDetail.missing": "関連イベントが見つかりません。", "xpack.securitySolution.endpoint.resolver.panel.relatedDetail.wait": "イベントを待機しています...", @@ -16415,16 +16411,16 @@ "xpack.securitySolution.endpoint.resolver.runningTrigger": "トリガーの実行中", "xpack.securitySolution.endpoint.resolver.terminatedProcess": "プロセスを中断しました", "xpack.securitySolution.endpoint.resolver.terminatedTrigger": "トリガーを中断しました", - "xpack.securitySolution.endpointList.endpointVersion": "バージョン", - "xpack.securitySolution.endpointList.hostname": "ホスト名", - "xpack.securitySolution.endpointList.hostStatus": "ホストステータス", - "xpack.securitySolution.endpointList.hostStatusValue": "{hostStatus, select, online {オンライン} error {エラー} other {オフライン}}", - "xpack.securitySolution.endpointList.ip": "IP アドレス", - "xpack.securitySolution.endpointList.lastActive": "前回のアーカイブ", - "xpack.securitySolution.endpointList.os": "オペレーティングシステム", - "xpack.securitySolution.endpointList.policy": "ポリシー", - "xpack.securitySolution.endpointList.policyStatus": "ポリシーステータス", - "xpack.securitySolution.endpointList.totalCount": "{totalItemCount, plural, one {# ホスト} other {# ホスト}}", + "xpack.securitySolution.endpoint.list.endpointVersion": "バージョン", + "xpack.securitySolution.endpoint.list.hostname": "ホスト名", + "xpack.securitySolution.endpoint.list.hostStatus": "ホストステータス", + "xpack.securitySolution.endpoint.list.hostStatusValue": "{hostStatus, select, online {オンライン} error {エラー} other {オフライン}}", + "xpack.securitySolution.endpoint.list.ip": "IP アドレス", + "xpack.securitySolution.endpoint.list.lastActive": "前回のアーカイブ", + "xpack.securitySolution.endpoint.list.os": "オペレーティングシステム", + "xpack.securitySolution.endpoint.list.policy": "ポリシー", + "xpack.securitySolution.endpoint.list.policyStatus": "ポリシーステータス", + "xpack.securitySolution.endpoint.list.totalCount": "{totalItemCount, plural, one {# ホスト} other {# ホスト}}", "xpack.securitySolution.endpointManagement.noPermissionsSubText": "Ingest Managerが無効である可能性があります。この機能を使用するには、Ingest Managerを有効にする必要があります。Ingest Managerを有効にする権限がない場合は、Kibana管理者に連絡してください。", "xpack.securitySolution.endpointManagemnet.noPermissionsText": "Elastic Security Administrationを使用するために必要なKibana権限がありません。", "xpack.securitySolution.enpdoint.resolver.panelutils.betaBadgeLabel": "BETA", @@ -16613,8 +16609,8 @@ "xpack.securitySolution.host.details.overview.platformTitle": "プラットフォーム", "xpack.securitySolution.host.details.overview.regionTitle": "地域", "xpack.securitySolution.host.details.versionLabel": "バージョン", - "xpack.securitySolution.hostList.pageSubTitle": "Elastic Endpoint Securityを実行しているホスト", - "xpack.securitySolution.hostList.pageTitle": "ホスト", + "xpack.securitySolution.endpoint.list.pageSubTitle": "Elastic Endpoint Securityを実行しているホスト", + "xpack.securitySolution.endpoint.list.pageTitle": "ホスト", "xpack.securitySolution.hosts.kqlPlaceholder": "例:host.name: \"foo\"", "xpack.securitySolution.hosts.navigation.alertsTitle": "外部アラート", "xpack.securitySolution.hosts.navigation.allHostsTitle": "すべてのホスト", @@ -16626,7 +16622,7 @@ "xpack.securitySolution.hosts.navigaton.matrixHistogram.errorFetchingAuthenticationsData": "認証データをクエリできませんでした", "xpack.securitySolution.hosts.navigaton.matrixHistogram.errorFetchingEventsData": "イベントデータをクエリできませんでした", "xpack.securitySolution.hosts.pageTitle": "ホスト", - "xpack.securitySolution.hostsTab": "ホスト", + "xpack.securitySolution.endpointsTab": "ホスト", "xpack.securitySolution.hostsTable.firstLastSeenToolTip": "選択された日付範囲との相関付けです", "xpack.securitySolution.hostsTable.hostsTitle": "すべてのホスト", "xpack.securitySolution.hostsTable.lastSeenTitle": "前回の認識", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 4c48a66b3c3c89..82a6b128ad619d 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -4284,7 +4284,6 @@ "visTypeVega.vegaParser.dataExceedsSomeParamsUseTimesLimitErrorMessage": "数据不得包含 {urlParam}、{valuesParam} 和 {sourceParam} 中的多个值", "visTypeVega.vegaParser.hostConfigIsDeprecatedWarningMessage": "{deprecatedConfigName} 已弃用。请改用 {newConfigName}。", "visTypeVega.vegaParser.hostConfigValueTypeErrorMessage": "如果存在,{configName} 必须为对象", - "visTypeVega.vegaParser.inputSpecDoesNotSpecifySchemaWarningMessage": "输入规范未指定 {schemaParam},其默认值为 {defaultSchema}", "visTypeVega.vegaParser.invalidVegaSpecErrorMessage": "Vega 规范无效", "visTypeVega.vegaParser.kibanaConfigValueTypeErrorMessage": "如果存在,{configName} 必须为对象", "visTypeVega.vegaParser.mapStyleValueTypeWarningMessage": "{mapStyleConfigName} 可能为 {mapStyleConfigFirstAllowedValue} 或 {mapStyleConfigSecondAllowedValue}", @@ -9839,11 +9838,8 @@ "xpack.ingestPipelines.requestFlyout.descriptionText": "此 Elasticsearch 请求将创建或更新管道。", "xpack.ingestPipelines.requestFlyout.namedTitle": "对“{name}”的请求", "xpack.ingestPipelines.requestFlyout.unnamedTitle": "请求", - "xpack.ingestPipelines.settingsFormFlyout.title": "配置处理器", "xpack.ingestPipelines.settingsFormOnFailureFlyout.addButtonLabel": "添加", "xpack.ingestPipelines.settingsFormOnFailureFlyout.cancelButtonLabel": "取消", - "xpack.ingestPipelines.settingsFormOnFailureFlyout.title": "配置失败时处理器", - "xpack.ingestPipelines.settingsFormOnFailureFlyout.updateButtonLabel": "更新", "xpack.ingestPipelines.tabs.documentsTabTitle": "文档", "xpack.ingestPipelines.tabs.outputTabTitle": "输出", "xpack.ingestPipelines.testPipelineFlyout.documentsForm.documentsFieldLabel": "文档", @@ -16241,65 +16237,65 @@ "xpack.securitySolution.editDataProvider.valuePlaceholder": "值", "xpack.securitySolution.emptyMessage": "Elastic Security 将免费且开放的 Elastic SIEM 和 Elastic Endpoint Security 整合在一起,从而防御、检测并响应威胁。首先,您需要将安全解决方案相关数据添加到 Elastic Stack。有关更多信息,请查看我们的 ", "xpack.securitySolution.emptyString.emptyStringDescription": "空字符串", - "xpack.securitySolution.endpoint.host.details.endpointVersion": "Endpoint 版本", - "xpack.securitySolution.endpoint.host.details.errorBody": "请退出浮出控件并选择可用主机。", - "xpack.securitySolution.endpoint.host.details.errorTitle": "找不到主机", - "xpack.securitySolution.endpoint.host.details.hostname": "主机名", - "xpack.securitySolution.endpoint.host.details.ipAddress": "IP 地址", - "xpack.securitySolution.endpoint.host.details.lastSeen": "最后看到时间", - "xpack.securitySolution.endpoint.host.details.linkToIngestTitle": "重新分配策略", - "xpack.securitySolution.endpoint.host.details.os": "OS", - "xpack.securitySolution.endpoint.host.details.policy": "政策", - "xpack.securitySolution.endpoint.host.details.policyStatus": "策略状态", - "xpack.securitySolution.endpoint.host.details.policyStatusValue": "{policyStatus, select, success {成功} warning {警告} failure {失败} other {未知}}", - "xpack.securitySolution.endpoint.host.policyResponse.backLinkTitle": "终端详情", - "xpack.securitySolution.endpoint.host.policyResponse.title": "策略响应", - "xpack.securitySolution.endpoint.hostDetails.noPolicyResponse": "没有可用的策略响应", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_dns_events": "配置 DNS 事件", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_elasticsearch_connection": "配置 Elastic 搜索连接", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_file_events": "配置文件事件", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_imageload_events": "配置映像加载事件", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_kernel": "配置内核", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_logging": "配置日志记录", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_malware": "配置恶意软件", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_network_events": "配置网络事件", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_process_events": "配置进程事件", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_registry_events": "配置注册表事件", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.configure_security_events": "配置安全事件", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.connect_kernel": "连接内核", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_async_image_load_events": "检测异步映像加载事件", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_file_open_events": "检测文件打开事件", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_file_write_events": "检测文件写入事件", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_network_events": "检测网络事件", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_process_events": "检测进程事件", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_registry_events": "检测注册表事件", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.detect_sync_image_load_events": "检测同步映像加载事件", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.download_global_artifacts": "下载全局项目", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.download_user_artifacts": "下面用户项目", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.events": "事件", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.failed": "失败", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.load_config": "加载配置", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.load_malware_model": "加载恶意软件模型", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.logging": "日志", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.malware": "恶意软件", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.read_elasticsearch_config": "读取 ElasticSearch 配置", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.read_events_config": "读取时间配置", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.read_kernel_config": "读取内核配置", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.read_logging_config": "读取日志配置", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.read_malware_config": "读取恶意软件配置", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.streaming": "流式传输", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.success": "成功", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.warning": "警告", - "xpack.securitySolution.endpoint.hostDetails.policyResponse.workflow": "工作流", - "xpack.securitySolution.endpoint.hostList.beta": "公测版", - "xpack.securitySolution.endpoint.hostList.loadingPolicies": "正在加载政策配置", - "xpack.securitySolution.endpoint.hostList.noEndpointsInstructions": "您已创建安全策略。现在您需要按照下面的步骤在代理上启用 Elastic Endpoint Security 功能。", - "xpack.securitySolution.endpoint.hostList.noEndpointsPrompt": "在您的代理上启用 Elastic Endpoint Security", - "xpack.securitySolution.endpoint.hostList.noPolicies": "没有策略。", - "xpack.securitySolution.endpoint.hostList.stepOne": "现有策略在下面列出。之后可以对其进行更改。", - "xpack.securitySolution.endpoint.hostList.stepOneTitle": "选择要用于保护主机的策略", - "xpack.securitySolution.endpoint.hostList.stepTwo": "为了让您入门,将会为您提供必要的命令。", - "xpack.securitySolution.endpoint.hostList.stepTwoTitle": "通过采集管理器注册启用 Endpoint Security 的代理", + "xpack.securitySolution.endpoint.details.endpointVersion": "Endpoint 版本", + "xpack.securitySolution.endpoint.details.errorBody": "请退出浮出控件并选择可用主机。", + "xpack.securitySolution.endpoint.details.errorTitle": "找不到主机", + "xpack.securitySolution.endpoint.details.hostname": "主机名", + "xpack.securitySolution.endpoint.details.ipAddress": "IP 地址", + "xpack.securitySolution.endpoint.details.lastSeen": "最后看到时间", + "xpack.securitySolution.endpoint.details.linkToIngestTitle": "重新分配策略", + "xpack.securitySolution.endpoint.details.os": "OS", + "xpack.securitySolution.endpoint.details.policy": "政策", + "xpack.securitySolution.endpoint.details.policyStatus": "策略状态", + "xpack.securitySolution.endpoint.details.policyStatusValue": "{policyStatus, select, success {成功} warning {警告} failure {失败} other {未知}}", + "xpack.securitySolution.endpoint.policyResponse.backLinkTitle": "终端详情", + "xpack.securitySolution.endpoint.policyResponse.title": "策略响应", + "xpack.securitySolution.endpoint.details.noPolicyResponse": "没有可用的策略响应", + "xpack.securitySolution.endpoint.details.policyResponse.configure_dns_events": "配置 DNS 事件", + "xpack.securitySolution.endpoint.details.policyResponse.configure_elasticsearch_connection": "配置 Elastic 搜索连接", + "xpack.securitySolution.endpoint.details.policyResponse.configure_file_events": "配置文件事件", + "xpack.securitySolution.endpoint.details.policyResponse.configure_imageload_events": "配置映像加载事件", + "xpack.securitySolution.endpoint.details.policyResponse.configure_kernel": "配置内核", + "xpack.securitySolution.endpoint.details.policyResponse.configure_logging": "配置日志记录", + "xpack.securitySolution.endpoint.details.policyResponse.configure_malware": "配置恶意软件", + "xpack.securitySolution.endpoint.details.policyResponse.configure_network_events": "配置网络事件", + "xpack.securitySolution.endpoint.details.policyResponse.configure_process_events": "配置进程事件", + "xpack.securitySolution.endpoint.details.policyResponse.configure_registry_events": "配置注册表事件", + "xpack.securitySolution.endpoint.details.policyResponse.configure_security_events": "配置安全事件", + "xpack.securitySolution.endpoint.details.policyResponse.connect_kernel": "连接内核", + "xpack.securitySolution.endpoint.details.policyResponse.detect_async_image_load_events": "检测异步映像加载事件", + "xpack.securitySolution.endpoint.details.policyResponse.detect_file_open_events": "检测文件打开事件", + "xpack.securitySolution.endpoint.details.policyResponse.detect_file_write_events": "检测文件写入事件", + "xpack.securitySolution.endpoint.details.policyResponse.detect_network_events": "检测网络事件", + "xpack.securitySolution.endpoint.details.policyResponse.detect_process_events": "检测进程事件", + "xpack.securitySolution.endpoint.details.policyResponse.detect_registry_events": "检测注册表事件", + "xpack.securitySolution.endpoint.details.policyResponse.detect_sync_image_load_events": "检测同步映像加载事件", + "xpack.securitySolution.endpoint.details.policyResponse.download_global_artifacts": "下载全局项目", + "xpack.securitySolution.endpoint.details.policyResponse.download_user_artifacts": "下面用户项目", + "xpack.securitySolution.endpoint.details.policyResponse.events": "事件", + "xpack.securitySolution.endpoint.details.policyResponse.failed": "失败", + "xpack.securitySolution.endpoint.details.policyResponse.load_config": "加载配置", + "xpack.securitySolution.endpoint.details.policyResponse.load_malware_model": "加载恶意软件模型", + "xpack.securitySolution.endpoint.details.policyResponse.logging": "日志", + "xpack.securitySolution.endpoint.details.policyResponse.malware": "恶意软件", + "xpack.securitySolution.endpoint.details.policyResponse.read_elasticsearch_config": "读取 ElasticSearch 配置", + "xpack.securitySolution.endpoint.details.policyResponse.read_events_config": "读取时间配置", + "xpack.securitySolution.endpoint.details.policyResponse.read_kernel_config": "读取内核配置", + "xpack.securitySolution.endpoint.details.policyResponse.read_logging_config": "读取日志配置", + "xpack.securitySolution.endpoint.details.policyResponse.read_malware_config": "读取恶意软件配置", + "xpack.securitySolution.endpoint.details.policyResponse.streaming": "流式传输", + "xpack.securitySolution.endpoint.details.policyResponse.success": "成功", + "xpack.securitySolution.endpoint.details.policyResponse.warning": "警告", + "xpack.securitySolution.endpoint.details.policyResponse.workflow": "工作流", + "xpack.securitySolution.endpoint.list.beta": "公测版", + "xpack.securitySolution.endpoint.list.loadingPolicies": "正在加载政策配置", + "xpack.securitySolution.endpoint.list.noEndpointsInstructions": "您已创建安全策略。现在您需要按照下面的步骤在代理上启用 Elastic Endpoint Security 功能。", + "xpack.securitySolution.endpoint.list.noEndpointsPrompt": "在您的代理上启用 Elastic Endpoint Security", + "xpack.securitySolution.endpoint.list.noPolicies": "没有策略。", + "xpack.securitySolution.endpoint.list.stepOne": "现有策略在下面列出。之后可以对其进行更改。", + "xpack.securitySolution.endpoint.list.stepOneTitle": "选择要用于保护主机的策略", + "xpack.securitySolution.endpoint.list.stepTwo": "为了让您入门,将会为您提供必要的命令。", + "xpack.securitySolution.endpoint.list.stepTwoTitle": "通过采集管理器注册启用 Endpoint Security 的代理", "xpack.securitySolution.endpoint.ingestManager.createPackageConfig.endpointConfiguration": "使用此代理配置的任何代理都会使用基本策略。可以在 Security 应用中对此策略进行更改,Fleet 会将这些更改部署到代理。", "xpack.securitySolution.endpoint.ingestToastMessage": "采集管理器在其设置期间失败。", "xpack.securitySolution.endpoint.ingestToastTitle": "应用无法初始化", @@ -16390,7 +16386,7 @@ "xpack.securitySolution.endpoint.resolver.panel.processEventListByType.eventDescriptiveName": "{descriptor} {subject}", "xpack.securitySolution.endpoint.resolver.panel.processEventListByType.events": "事件", "xpack.securitySolution.endpoint.resolver.panel.processEventListByType.wait": "等候事件......", - "xpack.securitySolution.endpoint.resolver.panel.processListWithCounts.events": "所有进程事件", + "xpack.securitySolution.resolver.panel.nodeList.title": "所有进程事件", "xpack.securitySolution.endpoint.resolver.panel.relatedCounts.numberOfEventsInCrumb": "{totalCount} 个事件", "xpack.securitySolution.endpoint.resolver.panel.relatedDetail.missing": "找不到相关事件。", "xpack.securitySolution.endpoint.resolver.panel.relatedDetail.wait": "等候事件......", @@ -16421,16 +16417,16 @@ "xpack.securitySolution.endpoint.resolver.runningTrigger": "正在运行的触发器", "xpack.securitySolution.endpoint.resolver.terminatedProcess": "已终止进程", "xpack.securitySolution.endpoint.resolver.terminatedTrigger": "已终止触发器", - "xpack.securitySolution.endpointList.endpointVersion": "版本", - "xpack.securitySolution.endpointList.hostname": "主机名", - "xpack.securitySolution.endpointList.hostStatus": "主机状态", - "xpack.securitySolution.endpointList.hostStatusValue": "{hostStatus, select, online {联机} error {错误} other {脱机}}", - "xpack.securitySolution.endpointList.ip": "IP 地址", - "xpack.securitySolution.endpointList.lastActive": "上次活动时间", - "xpack.securitySolution.endpointList.os": "操作系统", - "xpack.securitySolution.endpointList.policy": "政策", - "xpack.securitySolution.endpointList.policyStatus": "策略状态", - "xpack.securitySolution.endpointList.totalCount": "{totalItemCount, plural, one {# 个主机} other {# 个主机}}", + "xpack.securitySolution.endpoint.list.endpointVersion": "版本", + "xpack.securitySolution.endpoint.list.hostname": "主机名", + "xpack.securitySolution.endpoint.list.hostStatus": "主机状态", + "xpack.securitySolution.endpoint.list.hostStatusValue": "{hostStatus, select, online {联机} error {错误} other {脱机}}", + "xpack.securitySolution.endpoint.list.ip": "IP 地址", + "xpack.securitySolution.endpoint.list.lastActive": "上次活动时间", + "xpack.securitySolution.endpoint.list.os": "操作系统", + "xpack.securitySolution.endpoint.list.policy": "政策", + "xpack.securitySolution.endpoint.list.policyStatus": "策略状态", + "xpack.securitySolution.endpoint.list.totalCount": "{totalItemCount, plural, one {# 个主机} other {# 个主机}}", "xpack.securitySolution.endpointManagement.noPermissionsSubText": "似乎采集管理器已禁用。必须启用采集管理器,才能使用此功能。如果您无权启用采集管理器,请联系您的 Kibana 管理员。", "xpack.securitySolution.endpointManagemnet.noPermissionsText": "您没有所需的 Kibana 权限,无法使用 Elastic Security 管理", "xpack.securitySolution.enpdoint.resolver.panelutils.betaBadgeLabel": "公测版", @@ -16619,8 +16615,8 @@ "xpack.securitySolution.host.details.overview.platformTitle": "平台", "xpack.securitySolution.host.details.overview.regionTitle": "地区", "xpack.securitySolution.host.details.versionLabel": "版本", - "xpack.securitySolution.hostList.pageSubTitle": "运行 Elastic Endpoint Security 的主机", - "xpack.securitySolution.hostList.pageTitle": "主机", + "xpack.securitySolution.endpoint.list.pageSubTitle": "运行 Elastic Endpoint Security 的主机", + "xpack.securitySolution.endpoint.list.pageTitle": "主机", "xpack.securitySolution.hosts.kqlPlaceholder": "例如 host.name:“foo”", "xpack.securitySolution.hosts.navigation.alertsTitle": "外部告警", "xpack.securitySolution.hosts.navigation.allHostsTitle": "所有主机", @@ -16632,7 +16628,7 @@ "xpack.securitySolution.hosts.navigaton.matrixHistogram.errorFetchingAuthenticationsData": "无法查询身份验证数据", "xpack.securitySolution.hosts.navigaton.matrixHistogram.errorFetchingEventsData": "无法查询事件数据", "xpack.securitySolution.hosts.pageTitle": "主机", - "xpack.securitySolution.hostsTab": "主机", + "xpack.securitySolution.endpointsTab": "主机", "xpack.securitySolution.hostsTable.firstLastSeenToolTip": "相对于选定日期范围", "xpack.securitySolution.hostsTable.hostsTitle": "所有主机", "xpack.securitySolution.hostsTable.lastSeenTitle": "最后看到时间", diff --git a/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/alert_types.ts b/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/alert_types.ts index ebf639067518fc..269a9d3a504a2b 100644 --- a/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/alert_types.ts +++ b/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/alert_types.ts @@ -296,7 +296,7 @@ export function defineAlertTypes( name: 'Default', }, ], - producer: 'alerting', + producer: 'alertsFixture', defaultActionGroupId: 'default', async executor({ services, params, state }: AlertExecutorOptions) { throw new Error('this alert is intended to fail'); @@ -306,7 +306,7 @@ export function defineAlertTypes( id: 'test.patternFiring', name: 'Test: Firing on a Pattern', actionGroups: [{ id: 'default', name: 'Default' }], - producer: 'alerting', + producer: 'alertsFixture', defaultActionGroupId: 'default', async executor(alertExecutorOptions: AlertExecutorOptions) { const { services, state, params } = alertExecutorOptions; diff --git a/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/plugin.ts b/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/plugin.ts index 5881201a82e09c..1b8a380eaaeb27 100644 --- a/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/plugin.ts +++ b/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/plugin.ts @@ -40,6 +40,8 @@ export class FixturePlugin implements Plugin `--xpack.${key}.enabled=false`), `--plugin-path=${path.join(__dirname, 'fixtures', 'plugins', 'alerts')}`, `--plugin-path=${path.join(__dirname, 'fixtures', 'plugins', 'actions')}`, diff --git a/x-pack/test/functional/apps/dashboard/reporting/screenshots.ts b/x-pack/test/functional/apps/dashboard/reporting/screenshots.ts index da1131d0515813..cf70e5a7b8b6c4 100644 --- a/x-pack/test/functional/apps/dashboard/reporting/screenshots.ts +++ b/x-pack/test/functional/apps/dashboard/reporting/screenshots.ts @@ -16,12 +16,13 @@ const mkdirAsync = promisify(fs.mkdir); const REPORTS_FOLDER = path.resolve(__dirname, 'reports'); -export default function ({ getService, getPageObjects }: FtrProviderContext) { +export default function ({ getPageObjects, getService }: FtrProviderContext) { + const PageObjects = getPageObjects(['reporting', 'common', 'dashboard']); const esArchiver = getService('esArchiver'); const browser = getService('browser'); const log = getService('log'); const config = getService('config'); - const PageObjects = getPageObjects(['reporting', 'common', 'dashboard']); + const es = getService('es'); describe('Screenshots', () => { before('initialize tests', async () => { @@ -33,6 +34,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { after('clean up archives', async () => { await esArchiver.unload('reporting/ecommerce'); await esArchiver.unload('reporting/ecommerce_kibana'); + await es.deleteByQuery({ + index: '.reporting-*', + refresh: true, + body: { query: { match_all: {} } }, + }); }); describe('Print PDF button', () => { diff --git a/x-pack/test/functional/apps/discover/reporting.ts b/x-pack/test/functional/apps/discover/reporting.ts index 32ccc59913dbc6..7181bf0c74271c 100644 --- a/x-pack/test/functional/apps/discover/reporting.ts +++ b/x-pack/test/functional/apps/discover/reporting.ts @@ -9,6 +9,7 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const log = getService('log'); + const es = getService('es'); const esArchiver = getService('esArchiver'); const browser = getService('browser'); const PageObjects = getPageObjects(['reporting', 'common', 'discover']); @@ -22,6 +23,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); after('clean up archives', async () => { await esArchiver.unload('reporting/ecommerce'); + await es.deleteByQuery({ + index: '.reporting-*', + refresh: true, + body: { query: { match_all: {} } }, + }); }); describe('Generate CSV button', () => { diff --git a/x-pack/test/functional/apps/lens/lens_reporting.ts b/x-pack/test/functional/apps/lens/lens_reporting.ts index 3e3d217b9d8d7e..4974b63be6f72c 100644 --- a/x-pack/test/functional/apps/lens/lens_reporting.ts +++ b/x-pack/test/functional/apps/lens/lens_reporting.ts @@ -9,6 +9,7 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects(['common', 'dashboard', 'reporting']); + const es = getService('es'); const esArchiver = getService('esArchiver'); const listingTable = getService('listingTable'); @@ -19,6 +20,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { after(async () => { await esArchiver.unload('lens/reporting'); + await es.deleteByQuery({ + index: '.reporting-*', + refresh: true, + body: { query: { match_all: {} } }, + }); }); it('should not cause PDF reports to fail', async () => { diff --git a/x-pack/test/functional/apps/maps/auto_fit_to_bounds.js b/x-pack/test/functional/apps/maps/auto_fit_to_bounds.js index c8e8db84df96fa..d3d4fe054ec348 100644 --- a/x-pack/test/functional/apps/maps/auto_fit_to_bounds.js +++ b/x-pack/test/functional/apps/maps/auto_fit_to_bounds.js @@ -10,6 +10,23 @@ export default function ({ getPageObjects }) { const PageObjects = getPageObjects(['maps']); describe('auto fit map to bounds', () => { + describe('initial location', () => { + before(async () => { + await PageObjects.maps.loadSavedMap( + 'document example - auto fit to bounds for initial location' + ); + }); + + it('should automatically fit to bounds on initial map load', async () => { + const hits = await PageObjects.maps.getHits(); + expect(hits).to.equal('6'); + + const { lat, lon } = await PageObjects.maps.getView(); + expect(Math.round(lat)).to.equal(41); + expect(Math.round(lon)).to.equal(-99); + }); + }); + describe('without joins', () => { before(async () => { await PageObjects.maps.loadSavedMap('document example'); @@ -25,10 +42,20 @@ export default function ({ getPageObjects }) { await PageObjects.maps.setAndSubmitQuery('machine.os.raw : "ios"'); await PageObjects.maps.waitForMapPanAndZoom(origView); + const hits = await PageObjects.maps.getHits(); + expect(hits).to.equal('2'); + const { lat, lon } = await PageObjects.maps.getView(); expect(Math.round(lat)).to.equal(43); expect(Math.round(lon)).to.equal(-102); }); + + it('should sync layers even when there is not data', async () => { + await PageObjects.maps.setAndSubmitQuery('machine.os.raw : "fake_os_with_no_matches"'); + + const hits = await PageObjects.maps.getHits(); + expect(hits).to.equal('0'); + }); }); describe('with joins', () => { diff --git a/x-pack/test/functional/apps/reporting_management/index.ts b/x-pack/test/functional/apps/reporting_management/index.ts index f44d5858d53a1a..8606c46053ab06 100644 --- a/x-pack/test/functional/apps/reporting_management/index.ts +++ b/x-pack/test/functional/apps/reporting_management/index.ts @@ -9,6 +9,6 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default ({ loadTestFile }: FtrProviderContext) => { describe('reporting management app', function () { this.tags('ciGroup7'); - loadTestFile(require.resolve('./report_delete_pagination')); + loadTestFile(require.resolve('./report_listing')); }); }; diff --git a/x-pack/test/functional/apps/reporting_management/report_delete_pagination.ts b/x-pack/test/functional/apps/reporting_management/report_delete_pagination.ts deleted file mode 100644 index 488314030085fb..00000000000000 --- a/x-pack/test/functional/apps/reporting_management/report_delete_pagination.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default ({ getPageObjects, getService }: FtrProviderContext) => { - const pageObjects = getPageObjects(['common', 'reporting']); - const log = getService('log'); - const retry = getService('retry'); - const security = getService('security'); - - const testSubjects = getService('testSubjects'); - const esArchiver = getService('esArchiver'); - - describe('Delete reports', function () { - before(async () => { - await security.testUser.setRoles(['kibana_admin', 'reporting_user']); - await esArchiver.load('empty_kibana'); - await esArchiver.load('reporting/archived_reports'); - await pageObjects.common.navigateToApp('reporting'); - await testSubjects.existOrFail('reportJobListing', { timeout: 200000 }); - }); - - after(async () => { - await esArchiver.unload('empty_kibana'); - await esArchiver.unload('reporting/archived_reports'); - await security.testUser.restoreDefaults(); - }); - - it('Confirm single report deletion works', async () => { - log.debug('Checking for reports.'); - await retry.try(async () => { - await testSubjects.click('checkboxSelectRow-k9a9xlwl0gpe1457b10rraq3'); - }); - const deleteButton = await testSubjects.find('deleteReportButton'); - await retry.waitFor('delete button to become enabled', async () => { - return await deleteButton.isEnabled(); - }); - await deleteButton.click(); - await testSubjects.exists('confirmModalBodyText'); - await testSubjects.click('confirmModalConfirmButton'); - await retry.try(async () => { - await testSubjects.waitForDeleted('checkboxSelectRow-k9a9xlwl0gpe1457b10rraq3'); - }); - }); - - // functional test for report pagination: https://github.com/elastic/kibana/pull/62881 - it('Report pagination', async () => { - const previousButton = await testSubjects.find('pagination-button-previous'); - expect(await previousButton.getAttribute('disabled')).to.be('true'); - await testSubjects.click('pagination-button-1'); - expect(await previousButton.getAttribute('disabled')).to.be(null); - }); - }); -}; diff --git a/x-pack/test/functional/apps/reporting_management/report_listing.ts b/x-pack/test/functional/apps/reporting_management/report_listing.ts new file mode 100644 index 00000000000000..5bb36103fc6f6f --- /dev/null +++ b/x-pack/test/functional/apps/reporting_management/report_listing.ts @@ -0,0 +1,121 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; +import { WebElementWrapper } from 'test/functional/services/lib/web_element_wrapper'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +const getTableTextFromElement = async (tableEl: WebElementWrapper) => { + const rows = await tableEl.findAllByCssSelector('tbody tr'); + return ( + await Promise.all( + rows.map(async (row) => { + return await row.getVisibleText(); + }) + ) + ).join('\n'); +}; + +export default ({ getPageObjects, getService }: FtrProviderContext) => { + const pageObjects = getPageObjects(['common', 'reporting']); + const log = getService('log'); + const retry = getService('retry'); + const security = getService('security'); + + const testSubjects = getService('testSubjects'); + const findInstance = getService('find'); + const esArchiver = getService('esArchiver'); + + describe('Listing of Reports', function () { + before(async () => { + await security.testUser.setRoles(['kibana_admin', 'reporting_user']); + await esArchiver.load('empty_kibana'); + }); + + beforeEach(async () => { + // to reset the data after deletion testing + await esArchiver.load('reporting/archived_reports'); + await pageObjects.common.navigateToApp('reporting'); + await testSubjects.existOrFail('reportJobListing', { timeout: 200000 }); + }); + + after(async () => { + await esArchiver.unload('empty_kibana'); + await security.testUser.restoreDefaults(); + }); + + afterEach(async () => { + await esArchiver.unload('reporting/archived_reports'); + }); + + it('Confirm single report deletion works', async () => { + log.debug('Checking for reports.'); + await retry.try(async () => { + await testSubjects.click('checkboxSelectRow-k9a9xlwl0gpe1457b10rraq3'); + }); + const deleteButton = await testSubjects.find('deleteReportButton'); + await retry.waitFor('delete button to become enabled', async () => { + return await deleteButton.isEnabled(); + }); + await deleteButton.click(); + await testSubjects.exists('confirmModalBodyText'); + await testSubjects.click('confirmModalConfirmButton'); + await retry.try(async () => { + await testSubjects.waitForDeleted('checkboxSelectRow-k9a9xlwl0gpe1457b10rraq3'); + }); + }); + + it('Paginates content', async () => { + const previousButton = await testSubjects.find('pagination-button-previous'); + + // previous CAN NOT be clicked + expect(await previousButton.getAttribute('disabled')).to.be('true'); + + // scan page 1 + let tableText = await getTableTextFromElement(await testSubjects.find('reportJobListing')); + const PAGE_CONTENT_1 = `[Logs] File Type Scatter Plot\nvisualization\n2020-04-21 @ 07:01 PM\ntest_user\nCompleted at 2020-04-21 @ 07:02 PM +[Logs] File Type Scatter Plot\nvisualization\n2020-04-21 @ 07:01 PM\ntest_user\nCompleted at 2020-04-21 @ 07:02 PM +[Logs] Heatmap\nvisualization\n2020-04-21 @ 07:00 PM\ntest_user\nCompleted at 2020-04-21 @ 07:01 PM +[Logs] Heatmap\nvisualization\n2020-04-21 @ 07:00 PM\ntest_user\nCompleted at 2020-04-21 @ 07:01 PM +[Flights] Flight Delays\nvisualization\n2020-04-21 @ 07:00 PM\ntest_user\nCompleted at 2020-04-21 @ 07:01 PM +[Flights] Flight Delays\nvisualization\n2020-04-21 @ 07:00 PM\ntest_user\nCompleted at 2020-04-21 @ 07:01 PM +pdf\ndashboard\n2020-04-21 @ 07:00 PM\ntest_user\nCompleted at 2020-04-21 @ 07:00 PM +pdf\ndashboard\n2020-04-21 @ 07:00 PM\ntest_user\nCompleted at 2020-04-21 @ 07:00 PM +[Flights] Flight Cancellations\nvisualization\n2020-04-21 @ 06:59 PM\ntest_user\nCompleted at 2020-04-21 @ 07:00 PM +[Flights] Markdown Instructions\nvisualization\n2020-04-21 @ 06:59 PM\ntest_user\nCompleted at 2020-04-21 @ 07:00 PM`; + expect(tableText).to.be(PAGE_CONTENT_1); + + // click page 2 + await testSubjects.click('pagination-button-1'); + await findInstance.byCssSelector('[data-test-page="1"]'); + + // previous CAN be clicked + expect(await previousButton.getAttribute('disabled')).to.be(null); + + // scan page 2 + tableText = await getTableTextFromElement(await testSubjects.find('reportJobListing')); + const PAGE_CONTENT_2 = `[eCommerce] Revenue Tracking\ncanvas workpad\n2020-04-21 @ 06:58 PM\ntest_user\nCompleted at 2020-04-21 @ 06:59 PM +[Logs] Web Traffic\ncanvas workpad\n2020-04-21 @ 06:58 PM\ntest_user\nCompleted at 2020-04-21 @ 06:59 PM +[Flights] Overview\ncanvas workpad\n2020-04-21 @ 06:58 PM\ntest_user\nCompleted at 2020-04-21 @ 06:59 PM +[eCommerce] Revenue Dashboard\ndashboard\n2020-04-21 @ 06:57 PM\ntest_user\nCompleted at 2020-04-21 @ 06:58 PM +[Logs] Web Traffic\ndashboard\n2020-04-21 @ 06:57 PM\ntest_user\nCompleted at 2020-04-21 @ 06:58 PM +[Flights] Global Flight Dashboard\ndashboard\n2020-04-21 @ 06:56 PM\ntest_user\nCompleted at 2020-04-21 @ 06:57 PM +[Flights] Global Flight Dashboard\ndashboard\n2020-04-21 @ 06:56 PM\ntest_user\nCompleted at 2020-04-21 @ 06:57 PM +report4csv\n2020-04-21 @ 06:55 PM\ntest_user\nCompleted at 2020-04-21 @ 06:56 PM - Max size reached\nreport3csv\n2020-04-21 @ 06:55 PM +test_user\nCompleted at 2020-04-21 @ 06:55 PM - Max size reached\nreport2csv\n2020-04-21 @ 06:54 PM\ntest_user\nCompleted at 2020-04-21 @ 06:55 PM - Max size reached`; + expect(tableText).to.be(PAGE_CONTENT_2); + + // click page 3 + await testSubjects.click('pagination-button-2'); + await findInstance.byCssSelector('[data-test-page="2"]'); + + // scan page 3 + tableText = await getTableTextFromElement(await testSubjects.find('reportJobListing')); + const PAGE_CONTENT_3 = `report1csv\n2020-04-21 @ 06:54 PM\ntest_user\nCompleted at 2020-04-21 @ 06:54 PM - Max size reached`; + expect(tableText).to.be(PAGE_CONTENT_3); + }); + }); +}; diff --git a/x-pack/test/functional/apps/visualize/reporting.ts b/x-pack/test/functional/apps/visualize/reporting.ts index 02fd74e9480f79..d1cea5a4481b16 100644 --- a/x-pack/test/functional/apps/visualize/reporting.ts +++ b/x-pack/test/functional/apps/visualize/reporting.ts @@ -8,6 +8,7 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { + const es = getService('es'); const esArchiver = getService('esArchiver'); const browser = getService('browser'); const log = getService('log'); @@ -29,6 +30,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { after('clean up archives', async () => { await esArchiver.unload('reporting/ecommerce'); await esArchiver.unload('reporting/ecommerce_kibana'); + await es.deleteByQuery({ + index: '.reporting-*', + refresh: true, + body: { query: { match_all: {} } }, + }); }); describe('Print PDF button', () => { diff --git a/x-pack/test/functional/es_archives/maps/kibana/data.json b/x-pack/test/functional/es_archives/maps/kibana/data.json index 7690c925893123..198174bccb2863 100644 --- a/x-pack/test/functional/es_archives/maps/kibana/data.json +++ b/x-pack/test/functional/es_archives/maps/kibana/data.json @@ -979,6 +979,35 @@ } } +{ + "type": "doc", + "value": { + "id": "map:13776f20-db37-11ea-8fbb-3da39bb9bff2", + "index": ".kibana", + "source": { + "map" : { + "title" : "document example - auto fit to bounds for initial location", + "description" : "", + "mapStateJSON" : "{\"zoom\":5.2,\"center\":{\"lon\":-67.80052,\"lat\":-55.25331},\"timeFilters\":{\"from\":\"2015-09-20T00:00:00.000Z\",\"to\":\"2015-09-20T01:00:00.000Z\"},\"refreshConfig\":{\"isPaused\":true,\"interval\":1000},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[],\"settings\":{\"autoFitToDataBounds\":false,\"initialLocation\":\"AUTO_FIT_TO_BOUNDS\",\"fixedLocation\":{\"lat\":0,\"lon\":0,\"zoom\":2},\"browserLocation\":{\"zoom\":2},\"maxZoom\":24,\"minZoom\":0,\"showSpatialFilters\":true,\"spatialFiltersAlpa\":0.3,\"spatialFiltersFillColor\":\"#DA8B45\",\"spatialFiltersLineColor\":\"#DA8B45\"}}", + "layerListJSON" : "[{\"id\":\"0hmz5\",\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"id\":\"road_map\"},\"visible\":true,\"temporary\":false,\"style\":{\"type\":\"TILE\",\"properties\":{}},\"type\":\"VECTOR_TILE\",\"minZoom\":0,\"maxZoom\":24},{\"id\":\"z52lq\",\"label\":\"logstash\",\"minZoom\":0,\"maxZoom\":24,\"sourceDescriptor\":{\"id\":\"e1a5e1a6-676c-4a89-8ea9-0d91d64b73c6\",\"type\":\"ES_SEARCH\",\"geoField\":\"geo.coordinates\",\"limit\":2048,\"filterByMapBounds\":true,\"showTooltip\":true,\"tooltipProperties\":[],\"applyGlobalQuery\":true,\"scalingType\":\"LIMIT\",\"indexPatternRefName\":\"layer_1_source_index_pattern\"},\"visible\":true,\"temporary\":false,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#e6194b\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}},\"symbolizeAs\":{\"options\":{\"value\":\"circle\"}},\"icon\":{\"type\":\"STATIC\",\"options\":{\"value\":\"marker\"}}},\"previousStyle\":null},\"type\":\"VECTOR\"}]", + "uiStateJSON" : "{\"isLayerTOCOpen\":true,\"openTOCDetails\":[]}" + }, + "type" : "map", + "references" : [ + { + "name" : "layer_1_source_index_pattern", + "type" : "index-pattern", + "id" : "c698b940-e149-11e8-a35a-370a8516603a" + } + ], + "migrationVersion" : { + "map" : "7.9.0" + }, + "updated_at" : "2020-08-10T18:27:39.805Z" + } + } +} + { "type": "doc", "value": { diff --git a/x-pack/test/lists_api_integration/common/config.ts b/x-pack/test/lists_api_integration/common/config.ts new file mode 100644 index 00000000000000..ca3cc3a5eee2f7 --- /dev/null +++ b/x-pack/test/lists_api_integration/common/config.ts @@ -0,0 +1,69 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import path from 'path'; +import { CA_CERT_PATH } from '@kbn/dev-utils'; +import { FtrConfigProviderContext } from '@kbn/test/types/ftr'; +import { services } from './services'; + +interface CreateTestConfigOptions { + license: string; + disabledPlugins?: string[]; + ssl?: boolean; +} + +export function createTestConfig(name: string, options: CreateTestConfigOptions) { + const { license = 'trial', disabledPlugins = [], ssl = false } = options; + + return async ({ readConfigFile }: FtrConfigProviderContext) => { + const xPackApiIntegrationTestsConfig = await readConfigFile( + require.resolve('../../api_integration/config.ts') + ); + const servers = { + ...xPackApiIntegrationTestsConfig.get('servers'), + elasticsearch: { + ...xPackApiIntegrationTestsConfig.get('servers.elasticsearch'), + protocol: ssl ? 'https' : 'http', + }, + }; + + return { + testFiles: [require.resolve(`../${name}/tests/`)], + servers, + services, + junit: { + reportName: 'X-Pack Lists Integration Tests', + }, + esArchiver: xPackApiIntegrationTestsConfig.get('esArchiver'), + esTestCluster: { + ...xPackApiIntegrationTestsConfig.get('esTestCluster'), + license, + ssl, + serverArgs: [ + `xpack.license.self_generated.type=${license}`, + `xpack.security.enabled=${!disabledPlugins.includes('security')}`, + ], + }, + kbnTestServer: { + ...xPackApiIntegrationTestsConfig.get('kbnTestServer'), + serverArgs: [ + ...xPackApiIntegrationTestsConfig.get('kbnTestServer.serverArgs'), + ...disabledPlugins.map((key) => `--xpack.${key}.enabled=false`), + `--plugin-path=${path.join(__dirname, 'fixtures', 'plugins', 'alerts')}`, + `--plugin-path=${path.join(__dirname, 'fixtures', 'plugins', 'actions')}`, + `--plugin-path=${path.join(__dirname, 'fixtures', 'plugins', 'task_manager')}`, + `--plugin-path=${path.join(__dirname, 'fixtures', 'plugins', 'aad')}`, + ...(ssl + ? [ + `--elasticsearch.hosts=${servers.elasticsearch.protocol}://${servers.elasticsearch.hostname}:${servers.elasticsearch.port}`, + `--elasticsearch.ssl.certificateAuthorities=${CA_CERT_PATH}`, + ] + : []), + ], + }, + }; + }; +} diff --git a/x-pack/test/lists_api_integration/common/ftr_provider_context.d.ts b/x-pack/test/lists_api_integration/common/ftr_provider_context.d.ts new file mode 100644 index 00000000000000..e3add3748f56d7 --- /dev/null +++ b/x-pack/test/lists_api_integration/common/ftr_provider_context.d.ts @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { GenericFtrProviderContext } from '@kbn/test/types/ftr'; + +import { services } from './services'; + +export type FtrProviderContext = GenericFtrProviderContext; diff --git a/x-pack/test/lists_api_integration/common/services.ts b/x-pack/test/lists_api_integration/common/services.ts new file mode 100644 index 00000000000000..a927a31469bab1 --- /dev/null +++ b/x-pack/test/lists_api_integration/common/services.ts @@ -0,0 +1,7 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export { services } from '../../api_integration/services'; diff --git a/x-pack/test/lists_api_integration/security_and_spaces/config.ts b/x-pack/test/lists_api_integration/security_and_spaces/config.ts new file mode 100644 index 00000000000000..081b901c47fc3c --- /dev/null +++ b/x-pack/test/lists_api_integration/security_and_spaces/config.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { createTestConfig } from '../common/config'; + +// eslint-disable-next-line import/no-default-export +export default createTestConfig('security_and_spaces', { + disabledPlugins: [], + license: 'trial', + ssl: true, +}); diff --git a/x-pack/test/lists_api_integration/security_and_spaces/tests/create_list_items.ts b/x-pack/test/lists_api_integration/security_and_spaces/tests/create_list_items.ts new file mode 100644 index 00000000000000..906e9a9ef4456c --- /dev/null +++ b/x-pack/test/lists_api_integration/security_and_spaces/tests/create_list_items.ts @@ -0,0 +1,115 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; + +import { LIST_URL, LIST_ITEM_URL } from '../../../../plugins/lists/common/constants'; +import { FtrProviderContext } from '../../common/ftr_provider_context'; + +import { getCreateMinimalListSchemaMock } from '../../../../plugins/lists/common/schemas/request/create_list_schema.mock'; + +import { + getCreateMinimalListItemSchemaMock, + getCreateMinimalListItemSchemaMockWithoutId, +} from '../../../../plugins/lists/common/schemas/request/create_list_item_schema.mock'; +import { getListItemResponseMockWithoutAutoGeneratedValues } from '../../../../plugins/lists/common/schemas/response/list_item_schema.mock'; + +import { + createListsIndex, + deleteListsIndex, + removeListItemServerGeneratedProperties, +} from '../../utils'; + +// eslint-disable-next-line import/no-default-export +export default ({ getService }: FtrProviderContext) => { + const supertest = getService('supertest'); + + describe('create_list_items', () => { + describe('validation errors', () => { + it('should give a 404 error that the list must exist first before being able to add a list item', async () => { + const { body } = await supertest + .post(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListItemSchemaMock()) + .expect(404); + + expect(body).to.eql({ + message: 'list id: "some-list-id" does not exist', + status_code: 404, + }); + }); + }); + + describe('creating list items', () => { + beforeEach(async () => { + await createListsIndex(supertest); + }); + + afterEach(async () => { + await deleteListsIndex(supertest); + }); + + it('should create a simple list item with a list item id', async () => { + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + const { body } = await supertest + .post(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListItemSchemaMock()) + .expect(200); + + const bodyToCompare = removeListItemServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(getListItemResponseMockWithoutAutoGeneratedValues()); + }); + + it('should create a simple list item without an id', async () => { + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + const { body } = await supertest + .post(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListItemSchemaMockWithoutId()) + .expect(200); + + const bodyToCompare = removeListItemServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(getListItemResponseMockWithoutAutoGeneratedValues()); + }); + + it('should cause a 409 conflict if we attempt to create the same list item twice', async () => { + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + await supertest + .post(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListItemSchemaMock()) + .expect(200); + + const { body } = await supertest + .post(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListItemSchemaMock()) + .expect(409); + + expect(body).to.eql({ + message: 'list item id: "some-list-item-id" already exists', + status_code: 409, + }); + }); + }); + }); +}; diff --git a/x-pack/test/lists_api_integration/security_and_spaces/tests/create_lists.ts b/x-pack/test/lists_api_integration/security_and_spaces/tests/create_lists.ts new file mode 100644 index 00000000000000..b9d61eeacfee80 --- /dev/null +++ b/x-pack/test/lists_api_integration/security_and_spaces/tests/create_lists.ts @@ -0,0 +1,95 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; + +import { LIST_URL } from '../../../../plugins/lists/common/constants'; +import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { + getCreateMinimalListSchemaMock, + getCreateMinimalListSchemaMockWithoutId, +} from '../../../../plugins/lists/common/schemas/request/create_list_schema.mock'; +import { getListResponseMockWithoutAutoGeneratedValues } from '../../../../plugins/lists/common/schemas/response/list_schema.mock'; + +import { + createListsIndex, + deleteListsIndex, + removeListServerGeneratedProperties, +} from '../../utils'; + +// eslint-disable-next-line import/no-default-export +export default ({ getService }: FtrProviderContext) => { + const supertest = getService('supertest'); + + describe('create_lists', () => { + describe('validation errors', () => { + it('should give an error that the index must exist first if it does not exist before creating a list', async () => { + const { body } = await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(400); + + expect(body).to.eql({ + message: + 'To create a list, the index must exist first. Index ".lists-default" does not exist', + status_code: 400, + }); + }); + }); + + describe('creating lists', () => { + beforeEach(async () => { + await createListsIndex(supertest); + }); + + afterEach(async () => { + await deleteListsIndex(supertest); + }); + + it('should create a simple list with a list_id', async () => { + const { body } = await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + const bodyToCompare = removeListServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(getListResponseMockWithoutAutoGeneratedValues()); + }); + + it('should create a simple list without a list_id', async () => { + const { body } = await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMockWithoutId()) + .expect(200); + + const bodyToCompare = removeListServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(getListResponseMockWithoutAutoGeneratedValues()); + }); + + it('should cause a 409 conflict if we attempt to create the same list_id twice', async () => { + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + const { body } = await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(409); + + expect(body).to.eql({ + message: 'list id: "some-list-id" already exists', + status_code: 409, + }); + }); + }); + }); +}; diff --git a/x-pack/test/lists_api_integration/security_and_spaces/tests/delete_list_items.ts b/x-pack/test/lists_api_integration/security_and_spaces/tests/delete_list_items.ts new file mode 100644 index 00000000000000..83ba9728efdc9d --- /dev/null +++ b/x-pack/test/lists_api_integration/security_and_spaces/tests/delete_list_items.ts @@ -0,0 +1,98 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; + +import { getListItemResponseMockWithoutAutoGeneratedValues } from '../../../../plugins/lists/common/schemas/response/list_item_schema.mock'; +import { getCreateMinimalListItemSchemaMock } from '../../../../plugins/lists/common/schemas/request/create_list_item_schema.mock'; +import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { LIST_URL, LIST_ITEM_URL } from '../../../../plugins/lists/common/constants'; + +import { getCreateMinimalListSchemaMock } from '../../../../plugins/lists/common/schemas/request/create_list_schema.mock'; +import { + createListsIndex, + deleteListsIndex, + removeListItemServerGeneratedProperties, +} from '../../utils'; + +// eslint-disable-next-line import/no-default-export +export default ({ getService }: FtrProviderContext) => { + const supertest = getService('supertest'); + + describe('delete_list_items', () => { + describe('deleting list items', () => { + beforeEach(async () => { + await createListsIndex(supertest); + }); + + afterEach(async () => { + await deleteListsIndex(supertest); + }); + + it('should delete a single list item with a list item id', async () => { + // create a list + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + // create a list item + await supertest + .post(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListItemSchemaMock()) + .expect(200); + + // delete the list item by its list item id + const { body } = await supertest + .delete(`${LIST_ITEM_URL}?id=${getCreateMinimalListItemSchemaMock().id}`) + .set('kbn-xsrf', 'true') + .expect(200); + + const bodyToCompare = removeListItemServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(getListItemResponseMockWithoutAutoGeneratedValues()); + }); + + it('should delete a single list using an auto generated id', async () => { + // create a list + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + // create a list item + const { body: bodyWithCreateListItem } = await supertest + .post(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListItemSchemaMock()) + .expect(200); + + // delete that list by its auto-generated id + const { body } = await supertest + .delete(`${LIST_ITEM_URL}?id=${bodyWithCreateListItem.id}`) + .set('kbn-xsrf', 'true') + .expect(200); + + const bodyToCompare = removeListItemServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(getListItemResponseMockWithoutAutoGeneratedValues()); + }); + + it('should return an error if the id does not exist when trying to delete it', async () => { + const { body } = await supertest + .delete(`${LIST_ITEM_URL}?id=c1e1b359-7ac1-4e96-bc81-c683c092436f`) + .set('kbn-xsrf', 'true') + .expect(404); + + expect(body).to.eql({ + message: 'list item with id: "c1e1b359-7ac1-4e96-bc81-c683c092436f" not found', + status_code: 404, + }); + }); + }); + }); +}; diff --git a/x-pack/test/lists_api_integration/security_and_spaces/tests/delete_lists.ts b/x-pack/test/lists_api_integration/security_and_spaces/tests/delete_lists.ts new file mode 100644 index 00000000000000..3703e1b6ca3060 --- /dev/null +++ b/x-pack/test/lists_api_integration/security_and_spaces/tests/delete_lists.ts @@ -0,0 +1,83 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; + +import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { LIST_URL } from '../../../../plugins/lists/common/constants'; + +import { getCreateMinimalListSchemaMock } from '../../../../plugins/lists/common/schemas/request/create_list_schema.mock'; +import { + createListsIndex, + deleteListsIndex, + removeListServerGeneratedProperties, +} from '../../utils'; +import { getListResponseMockWithoutAutoGeneratedValues } from '../../../../plugins/lists/common/schemas/response/list_schema.mock'; + +// eslint-disable-next-line import/no-default-export +export default ({ getService }: FtrProviderContext) => { + const supertest = getService('supertest'); + + describe('delete_lists', () => { + describe('deleting lists', () => { + beforeEach(async () => { + await createListsIndex(supertest); + }); + + afterEach(async () => { + await deleteListsIndex(supertest); + }); + + it('should delete a single list with a list id', async () => { + // create a list + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + // delete the list by its list id + const { body } = await supertest + .delete(`${LIST_URL}?id=${getCreateMinimalListSchemaMock().id}`) + .set('kbn-xsrf', 'true') + .expect(200); + + const bodyToCompare = removeListServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(getListResponseMockWithoutAutoGeneratedValues()); + }); + + it('should delete a single list using an auto generated id', async () => { + // add a list + const { body: bodyWithCreatedList } = await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + // delete that list by its auto-generated id + const { body } = await supertest + .delete(`${LIST_URL}?id=${bodyWithCreatedList.id}`) + .set('kbn-xsrf', 'true') + .expect(200); + + const bodyToCompare = removeListServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(getListResponseMockWithoutAutoGeneratedValues()); + }); + + it('should return an error if the id does not exist when trying to delete it', async () => { + const { body } = await supertest + .delete(`${LIST_URL}?id=c1e1b359-7ac1-4e96-bc81-c683c092436f`) + .set('kbn-xsrf', 'true') + .expect(404); + + expect(body).to.eql({ + message: 'list id: "c1e1b359-7ac1-4e96-bc81-c683c092436f" was not found', + status_code: 404, + }); + }); + }); + }); +}; diff --git a/x-pack/test/lists_api_integration/security_and_spaces/tests/export_list_items.ts b/x-pack/test/lists_api_integration/security_and_spaces/tests/export_list_items.ts new file mode 100644 index 00000000000000..6fe783fc497f2c --- /dev/null +++ b/x-pack/test/lists_api_integration/security_and_spaces/tests/export_list_items.ts @@ -0,0 +1,104 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; +import { getCreateMinimalListItemSchemaMock } from '../../../../plugins/lists/common/schemas/request/create_list_item_schema.mock'; +import { getCreateMinimalListSchemaMock } from '../../../../plugins/lists/common/schemas/request/create_list_schema.mock'; +import { LIST_ID, NAME } from '../../../../plugins/lists/common/constants.mock'; +import { CreateListItemSchema } from '../../../../plugins/lists/common/schemas'; +import { FtrProviderContext } from '../../common/ftr_provider_context'; + +import { LIST_ITEM_URL, LIST_URL } from '../../../../plugins/lists/common/constants'; + +import { createListsIndex, deleteListsIndex, binaryToString } from '../../utils'; + +// eslint-disable-next-line import/no-default-export +export default ({ getService }: FtrProviderContext): void => { + const supertest = getService('supertest'); + + describe('export_list_items', () => { + describe('exporting lists', () => { + beforeEach(async () => { + await createListsIndex(supertest); + }); + + afterEach(async () => { + await deleteListsIndex(supertest); + }); + + it('should set the response content types to be expected', async () => { + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + await supertest + .post(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListItemSchemaMock()) + .expect(200); + + await supertest + .post(`${LIST_ITEM_URL}/_export?list_id=${LIST_ID}`) + .set('kbn-xsrf', 'true') + .expect('Content-Disposition', `attachment; filename="${NAME}"`) + .expect(200); + }); + + it('should export a single list item with a list id', async () => { + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + await supertest + .post(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListItemSchemaMock()) + .expect(200); + + const { body } = await supertest + .post(`${LIST_ITEM_URL}/_export?list_id=${LIST_ID}`) + .set('kbn-xsrf', 'true') + .expect(200) + .parse(binaryToString); + + expect(body.toString()).to.eql('127.0.0.1\n'); + }); + + it('should export two list items with a list id', async () => { + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + await supertest + .post(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListItemSchemaMock()) + .expect(200); + + const secondList: CreateListItemSchema = { + ...getCreateMinimalListItemSchemaMock(), + id: 'list-item-2', + value: '127.0.0.2', + }; + await supertest.post(LIST_ITEM_URL).set('kbn-xsrf', 'true').send(secondList).expect(200); + + const { body } = await supertest + .post(`${LIST_ITEM_URL}/_export?list_id=${LIST_ID}`) + .set('kbn-xsrf', 'true') + .expect(200) + .parse(binaryToString); + + expect(body.toString()).to.eql('127.0.0.2\n127.0.0.1\n'); + }); + }); + }); +}; diff --git a/x-pack/test/lists_api_integration/security_and_spaces/tests/find_list_items.ts b/x-pack/test/lists_api_integration/security_and_spaces/tests/find_list_items.ts new file mode 100644 index 00000000000000..4c1f3dfdb67035 --- /dev/null +++ b/x-pack/test/lists_api_integration/security_and_spaces/tests/find_list_items.ts @@ -0,0 +1,116 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; + +import { LIST_ITEM_ID, LIST_ID } from '../../../../plugins/lists/common/constants.mock'; +import { getListItemResponseMockWithoutAutoGeneratedValues } from '../../../../plugins/lists/common/schemas/response/list_item_schema.mock'; +import { getCreateMinimalListItemSchemaMock } from '../../../../plugins/lists/common/schemas/request/create_list_item_schema.mock'; +import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { LIST_URL, LIST_ITEM_URL } from '../../../../plugins/lists/common/constants'; + +import { getCreateMinimalListSchemaMock } from '../../../../plugins/lists/common/schemas/request/create_list_schema.mock'; +import { + createListsIndex, + deleteListsIndex, + removeListItemServerGeneratedProperties, +} from '../../utils'; + +// eslint-disable-next-line import/no-default-export +export default ({ getService }: FtrProviderContext): void => { + const supertest = getService('supertest'); + + describe('find_list_items', () => { + describe('find list items', () => { + beforeEach(async () => { + await createListsIndex(supertest); + }); + + afterEach(async () => { + await deleteListsIndex(supertest); + }); + + it('should give a validation error if the list_id is not supplied', async () => { + const { body } = await supertest + .get(`${LIST_ITEM_URL}/_find`) + .set('kbn-xsrf', 'true') + .send() + .expect(400); + + expect(body).to.eql({ + error: 'Bad Request', + message: '[request query]: Invalid value "undefined" supplied to "list_id"', + statusCode: 400, + }); + }); + + it('should give a 404 if the list has not been created yet', async () => { + const { body } = await supertest + .get(`${LIST_ITEM_URL}/_find?list_id=${LIST_ITEM_ID}`) + .set('kbn-xsrf', 'true') + .send() + .expect(404); + + expect(body).to.eql({ + message: 'list id: "some-list-item-id" does not exist', + status_code: 404, + }); + }); + + it('should return an empty find body correctly if no list items are loaded', async () => { + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + const { body } = await supertest + .get(`${LIST_ITEM_URL}/_find?list_id=${LIST_ID}`) + .set('kbn-xsrf', 'true') + .send() + .expect(200); + + expect(body).to.eql({ + cursor: 'WzBd', + data: [], + page: 1, + per_page: 20, + total: 0, + }); + }); + + it('should return a single list item when a single list item is loaded from a find with defaults added', async () => { + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + await supertest + .post(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListItemSchemaMock()) + .expect(200); + + const { body } = await supertest + .get(`${LIST_ITEM_URL}/_find?list_id=${LIST_ID}`) + .set('kbn-xsrf', 'true') + .send() + .expect(200); + + body.data = [removeListItemServerGeneratedProperties(body.data[0])]; + // cursor is a constant changing value so we have to delete it as well. + delete body.cursor; + expect(body).to.eql({ + data: [getListItemResponseMockWithoutAutoGeneratedValues()], + page: 1, + per_page: 20, + total: 1, + }); + }); + }); + }); +}; diff --git a/x-pack/test/lists_api_integration/security_and_spaces/tests/find_lists.ts b/x-pack/test/lists_api_integration/security_and_spaces/tests/find_lists.ts new file mode 100644 index 00000000000000..7efe28a0b01a1b --- /dev/null +++ b/x-pack/test/lists_api_integration/security_and_spaces/tests/find_lists.ts @@ -0,0 +1,77 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; + +import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { LIST_URL } from '../../../../plugins/lists/common/constants'; + +import { getCreateMinimalListSchemaMock } from '../../../../plugins/lists/common/schemas/request/create_list_schema.mock'; +import { + createListsIndex, + deleteListsIndex, + removeListServerGeneratedProperties, +} from '../../utils'; +import { getListResponseMockWithoutAutoGeneratedValues } from '../../../../plugins/lists/common/schemas/response/list_schema.mock'; + +// eslint-disable-next-line import/no-default-export +export default ({ getService }: FtrProviderContext): void => { + const supertest = getService('supertest'); + + describe('find_lists', () => { + describe('find lists', () => { + beforeEach(async () => { + await createListsIndex(supertest); + }); + + afterEach(async () => { + await deleteListsIndex(supertest); + }); + + it('should return an empty find body correctly if no lists are loaded', async () => { + const { body } = await supertest + .get(`${LIST_URL}/_find`) + .set('kbn-xsrf', 'true') + .send() + .expect(200); + + expect(body).to.eql({ + cursor: 'WzBd', + data: [], + page: 1, + per_page: 20, + total: 0, + }); + }); + + it('should return a single list when a single list is loaded from a find with defaults added', async () => { + // add a single list + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + // query the single list from _find + const { body } = await supertest + .get(`${LIST_URL}/_find`) + .set('kbn-xsrf', 'true') + .send() + .expect(200); + + body.data = [removeListServerGeneratedProperties(body.data[0])]; + // cursor is a constant changing value so we have to delete it as well. + delete body.cursor; + expect(body).to.eql({ + data: [getListResponseMockWithoutAutoGeneratedValues()], + page: 1, + per_page: 20, + total: 1, + }); + }); + }); + }); +}; diff --git a/x-pack/test/lists_api_integration/security_and_spaces/tests/import_list_items.ts b/x-pack/test/lists_api_integration/security_and_spaces/tests/import_list_items.ts new file mode 100644 index 00000000000000..4befb6bbaf0500 --- /dev/null +++ b/x-pack/test/lists_api_integration/security_and_spaces/tests/import_list_items.ts @@ -0,0 +1,112 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; +import { ListItemSchema } from '../../../../plugins/lists/common/schemas'; +import { getListItemResponseMockWithoutAutoGeneratedValues } from '../../../../plugins/lists/common/schemas/response/list_item_schema.mock'; +import { ListSchema } from '../../../../plugins/lists/common'; +import { getListResponseMockWithoutAutoGeneratedValues } from '../../../../plugins/lists/common/schemas/response/list_schema.mock'; +import { FtrProviderContext } from '../../common/ftr_provider_context'; + +import { LIST_ITEM_URL } from '../../../../plugins/lists/common/constants'; + +import { + createListsIndex, + deleteListsIndex, + removeListServerGeneratedProperties, + removeListItemServerGeneratedProperties, + waitFor, +} from '../../utils'; + +import { getImportListItemAsBuffer } from '../../../../plugins/lists/common/schemas/request/import_list_item_schema.mock'; + +// eslint-disable-next-line import/no-default-export +export default ({ getService }: FtrProviderContext): void => { + const supertest = getService('supertest'); + + describe('import_list_items', () => { + describe('importing list items without an index', () => { + it('should not import a list item if the index does not exist yet', async () => { + const { body } = await supertest + .post(`${LIST_ITEM_URL}/_import?type=ip`) + .set('kbn-xsrf', 'true') + .attach('file', getImportListItemAsBuffer(['127.0.0.1', '127.0.0.2']), 'list_items.txt') + .expect('Content-Type', 'application/json; charset=utf-8') + .expect(400); + + expect(body).to.eql({ + status_code: 400, + message: + 'To import a list item, the index must exist first. Index ".lists-default" does not exist', + }); + }); + }); + + describe('importing rules with an index', () => { + beforeEach(async () => { + await createListsIndex(supertest); + }); + + afterEach(async () => { + await deleteListsIndex(supertest); + }); + + it('should set the response content types to be expected when importing two items', async () => { + await supertest + .post(`${LIST_ITEM_URL}/_import?type=ip`) + .set('kbn-xsrf', 'true') + .attach('file', getImportListItemAsBuffer(['127.0.0.1', '127.0.0.2']), 'list_items.txt') + .expect('Content-Type', 'application/json; charset=utf-8') + .expect(200); + }); + + it('should report that it imported a simple list successfully', async () => { + const { body } = await supertest + .post(`${LIST_ITEM_URL}/_import?type=ip`) + .set('kbn-xsrf', 'true') + .attach('file', getImportListItemAsBuffer(['127.0.0.1', '127.0.0.2']), 'list_items.txt') + .expect('Content-Type', 'application/json; charset=utf-8') + .expect(200); + + const bodyToCompare = removeListServerGeneratedProperties(body); + const outputtedList: Partial = { + ...getListResponseMockWithoutAutoGeneratedValues(), + name: 'list_items.txt', + description: 'File uploaded from file system of list_items.txt', + }; + expect(bodyToCompare).to.eql(outputtedList); + }); + + it('should be able to read imported list items back out correctly', async () => { + await supertest + .post(`${LIST_ITEM_URL}/_import?type=ip`) + .set('kbn-xsrf', 'true') + .attach('file', getImportListItemAsBuffer(['127.0.0.1', '127.0.0.2']), 'list_items.txt') + .expect(200); + + // Although we try to be aggressive with waitFor in the lists code base, there is still not guarantees + // that we will have the data just yet so we have to do a waitFor here for when it shows up + await waitFor(async () => { + const { status } = await supertest + .get(`${LIST_ITEM_URL}?list_id=list_items.txt&value=127.0.0.1`) + .send(); + return status !== 404; + }); + const { body } = await supertest + .get(`${LIST_ITEM_URL}?list_id=list_items.txt&value=127.0.0.1`) + .send() + .expect(200); + + const bodyToCompare = removeListItemServerGeneratedProperties(body[0]); + const outputtedList: Partial = { + ...getListItemResponseMockWithoutAutoGeneratedValues(), + list_id: 'list_items.txt', + }; + expect(bodyToCompare).to.eql(outputtedList); + }); + }); + }); +}; diff --git a/x-pack/test/lists_api_integration/security_and_spaces/tests/index.ts b/x-pack/test/lists_api_integration/security_and_spaces/tests/index.ts new file mode 100644 index 00000000000000..302877a680aa66 --- /dev/null +++ b/x-pack/test/lists_api_integration/security_and_spaces/tests/index.ts @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { FtrProviderContext } from '../../common/ftr_provider_context'; + +// eslint-disable-next-line import/no-default-export +export default ({ loadTestFile }: FtrProviderContext): void => { + describe('lists api security and spaces enabled', function () { + this.tags('ciGroup1'); + + loadTestFile(require.resolve('./create_lists')); + loadTestFile(require.resolve('./create_list_items')); + loadTestFile(require.resolve('./read_lists')); + loadTestFile(require.resolve('./read_list_items')); + loadTestFile(require.resolve('./update_lists')); + loadTestFile(require.resolve('./update_list_items')); + loadTestFile(require.resolve('./delete_lists')); + loadTestFile(require.resolve('./delete_list_items')); + loadTestFile(require.resolve('./find_lists')); + loadTestFile(require.resolve('./find_list_items')); + loadTestFile(require.resolve('./import_list_items')); + loadTestFile(require.resolve('./export_list_items')); + }); +}; diff --git a/x-pack/test/lists_api_integration/security_and_spaces/tests/read_list_items.ts b/x-pack/test/lists_api_integration/security_and_spaces/tests/read_list_items.ts new file mode 100644 index 00000000000000..5469973d70e503 --- /dev/null +++ b/x-pack/test/lists_api_integration/security_and_spaces/tests/read_list_items.ts @@ -0,0 +1,98 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; + +import { getListItemResponseMockWithoutAutoGeneratedValues } from '../../../../plugins/lists/common/schemas/response/list_item_schema.mock'; +import { getCreateMinimalListItemSchemaMock } from '../../../../plugins/lists/common/schemas/request/create_list_item_schema.mock'; +import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { LIST_URL, LIST_ITEM_URL } from '../../../../plugins/lists/common/constants'; + +import { getCreateMinimalListSchemaMock } from '../../../../plugins/lists/common/schemas/request/create_list_schema.mock'; +import { + createListsIndex, + deleteListsIndex, + removeListItemServerGeneratedProperties, +} from '../../utils'; + +// eslint-disable-next-line import/no-default-export +export default ({ getService }: FtrProviderContext) => { + const supertest = getService('supertest'); + + describe('read_list_items', () => { + describe('reading list items', () => { + beforeEach(async () => { + await createListsIndex(supertest); + }); + + afterEach(async () => { + await deleteListsIndex(supertest); + }); + + it('should be able to read a single list item using id', async () => { + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + await supertest + .post(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListItemSchemaMock()) + .expect(200); + + const { body } = await supertest + .get(`${LIST_ITEM_URL}?id=${getCreateMinimalListItemSchemaMock().id}`) + .set('kbn-xsrf', 'true') + .expect(200); + + const bodyToCompare = removeListItemServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(getListItemResponseMockWithoutAutoGeneratedValues()); + }); + + it('should be able to read a single list item with an auto-generated list id', async () => { + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + const { body: createListBody } = await supertest + .post(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListItemSchemaMock()) + .expect(200); + + const { body } = await supertest + .get(`${LIST_ITEM_URL}?id=${createListBody.id}`) + .set('kbn-xsrf', 'true') + .expect(200); + + const bodyToCompare = removeListItemServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(getListItemResponseMockWithoutAutoGeneratedValues()); + }); + + it('should return 404 if given a fake id', async () => { + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + const { body } = await supertest + .get(`${LIST_ITEM_URL}?id=c1e1b359-7ac1-4e96-bc81-c683c092436f`) + .set('kbn-xsrf', 'true') + .expect(404); + + expect(body).to.eql({ + status_code: 404, + message: 'list item id: "c1e1b359-7ac1-4e96-bc81-c683c092436f" does not exist', + }); + }); + }); + }); +}; diff --git a/x-pack/test/lists_api_integration/security_and_spaces/tests/read_lists.ts b/x-pack/test/lists_api_integration/security_and_spaces/tests/read_lists.ts new file mode 100644 index 00000000000000..c3c8cb39d023b5 --- /dev/null +++ b/x-pack/test/lists_api_integration/security_and_spaces/tests/read_lists.ts @@ -0,0 +1,84 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; + +import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { LIST_URL } from '../../../../plugins/lists/common/constants'; + +import { + getCreateMinimalListSchemaMock, + getCreateMinimalListSchemaMockWithoutId, +} from '../../../../plugins/lists/common/schemas/request/create_list_schema.mock'; +import { + createListsIndex, + deleteListsIndex, + removeListServerGeneratedProperties, +} from '../../utils'; +import { getListResponseMockWithoutAutoGeneratedValues } from '../../../../plugins/lists/common/schemas/response/list_schema.mock'; + +// eslint-disable-next-line import/no-default-export +export default ({ getService }: FtrProviderContext) => { + const supertest = getService('supertest'); + + describe('read_lists', () => { + describe('reading lists', () => { + beforeEach(async () => { + await createListsIndex(supertest); + }); + + afterEach(async () => { + await deleteListsIndex(supertest); + }); + + it('should be able to read a single list using id', async () => { + // create a simple list to read + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + const { body } = await supertest + .get(`${LIST_URL}?id=${getCreateMinimalListSchemaMock().id}`) + .set('kbn-xsrf', 'true') + .expect(200); + + const bodyToCompare = removeListServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(getListResponseMockWithoutAutoGeneratedValues()); + }); + + it('should be able to read a single list with an auto-generated list id', async () => { + // create a simple list to read + const { body: createListBody } = await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMockWithoutId()) + .expect(200); + + const { body } = await supertest + .get(`${LIST_URL}?id=${createListBody.id}`) + .set('kbn-xsrf', 'true') + .expect(200); + + const bodyToCompare = removeListServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(getListResponseMockWithoutAutoGeneratedValues()); + }); + + it('should return 404 if given a fake id', async () => { + const { body } = await supertest + .get(`${LIST_URL}?id=c1e1b359-7ac1-4e96-bc81-c683c092436f`) + .set('kbn-xsrf', 'true') + .expect(404); + + expect(body).to.eql({ + status_code: 404, + message: 'list id: "c1e1b359-7ac1-4e96-bc81-c683c092436f" does not exist', + }); + }); + }); + }); +}; diff --git a/x-pack/test/lists_api_integration/security_and_spaces/tests/update_list_items.ts b/x-pack/test/lists_api_integration/security_and_spaces/tests/update_list_items.ts new file mode 100644 index 00000000000000..3ff496216eb71a --- /dev/null +++ b/x-pack/test/lists_api_integration/security_and_spaces/tests/update_list_items.ts @@ -0,0 +1,154 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; + +import { getListItemResponseMockWithoutAutoGeneratedValues } from '../../../../plugins/lists/common/schemas/response/list_item_schema.mock'; +import { getCreateMinimalListItemSchemaMock } from '../../../../plugins/lists/common/schemas/request/create_list_item_schema.mock'; +import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { LIST_URL, LIST_ITEM_URL } from '../../../../plugins/lists/common/constants'; + +import { getCreateMinimalListSchemaMock } from '../../../../plugins/lists/common/schemas/request/create_list_schema.mock'; +import { + createListsIndex, + deleteListsIndex, + removeListItemServerGeneratedProperties, +} from '../../utils'; +import { getUpdateMinimalListItemSchemaMock } from '../../../../plugins/lists/common/schemas/request/update_list_item_schema.mock'; +import { + UpdateListItemSchema, + CreateListItemSchema, + ListItemSchema, +} from '../../../../plugins/lists/common/schemas'; + +// eslint-disable-next-line import/no-default-export +export default ({ getService }: FtrProviderContext) => { + const supertest = getService('supertest'); + + describe('update_list_items', () => { + describe('update list items', () => { + beforeEach(async () => { + await createListsIndex(supertest); + }); + + afterEach(async () => { + await deleteListsIndex(supertest); + }); + + it('should update a single list item property of value using an id', async () => { + // create a simple list + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + // create a simple list item + await supertest + .post(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListItemSchemaMock()) + .expect(200); + + // update a simple list item's value + const updatedListItem: UpdateListItemSchema = { + ...getUpdateMinimalListItemSchemaMock(), + value: '192.168.0.2', + }; + + const { body } = await supertest + .put(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(updatedListItem) + .expect(200); + + const outputListItem: Partial = { + ...getListItemResponseMockWithoutAutoGeneratedValues(), + value: '192.168.0.2', + }; + const bodyToCompare = removeListItemServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(outputListItem); + }); + + it('should update a single list item of value using an auto-generated id of both list and list item', async () => { + const { id, ...listNoId } = getCreateMinimalListSchemaMock(); + // create a simple list with no id which will use an auto-generated id + const { body: createListBody } = await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(listNoId) + .expect(200); + + // create a simple list item also with an auto-generated id using the list's auto-generated id + const listItem: CreateListItemSchema = { + ...getCreateMinimalListItemSchemaMock(), + list_id: createListBody.id, + }; + const { body: createListItemBody } = await supertest + .post(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(listItem) + .expect(200); + + // update a simple list item's value + const updatedList: UpdateListItemSchema = { + ...getUpdateMinimalListItemSchemaMock(), + id: createListItemBody.id, + value: '192.168.0.2', + }; + const { body } = await supertest + .put(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(updatedList) + .expect(200); + + const outputListItem: Partial = { + ...getListItemResponseMockWithoutAutoGeneratedValues(), + value: '192.168.0.2', + }; + const bodyToCompare = { + ...removeListItemServerGeneratedProperties(body), + list_id: outputListItem.list_id, + }; + expect(bodyToCompare).to.eql(outputListItem); + }); + + it('should give a 404 if it is given a fake id', async () => { + // create a simple list + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + // create a simple list item + await supertest + .post(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListItemSchemaMock()) + .expect(200); + + // update a simple list item's value + const updatedListItem: UpdateListItemSchema = { + ...getUpdateMinimalListItemSchemaMock(), + id: 'some-other-id', + value: '192.168.0.2', + }; + + const { body } = await supertest + .put(LIST_ITEM_URL) + .set('kbn-xsrf', 'true') + .send(updatedListItem) + .expect(404); + + expect(body).to.eql({ + status_code: 404, + message: 'list item id: "some-other-id" not found', + }); + }); + }); + }); +}; diff --git a/x-pack/test/lists_api_integration/security_and_spaces/tests/update_lists.ts b/x-pack/test/lists_api_integration/security_and_spaces/tests/update_lists.ts new file mode 100644 index 00000000000000..04d77ffe213703 --- /dev/null +++ b/x-pack/test/lists_api_integration/security_and_spaces/tests/update_lists.ts @@ -0,0 +1,141 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; + +import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { LIST_URL } from '../../../../plugins/lists/common/constants'; + +import { getCreateMinimalListSchemaMock } from '../../../../plugins/lists/common/schemas/request/create_list_schema.mock'; +import { + createListsIndex, + deleteListsIndex, + removeListServerGeneratedProperties, +} from '../../utils'; +import { getListResponseMockWithoutAutoGeneratedValues } from '../../../../plugins/lists/common/schemas/response/list_schema.mock'; +import { getUpdateMinimalListSchemaMock } from '../../../../plugins/lists/common/schemas/request/update_list_schema.mock'; +import { UpdateListSchema, ListSchema } from '../../../../plugins/lists/common/schemas'; + +// eslint-disable-next-line import/no-default-export +export default ({ getService }: FtrProviderContext) => { + const supertest = getService('supertest'); + + describe('update_lists', () => { + describe('update lists', () => { + beforeEach(async () => { + await createListsIndex(supertest); + }); + + afterEach(async () => { + await deleteListsIndex(supertest); + }); + + it('should update a single list property of name using an id', async () => { + // create a simple list + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + // update a simple list's name + const updatedList: UpdateListSchema = { + ...getUpdateMinimalListSchemaMock(), + name: 'some other name', + }; + + const { body } = await supertest + .put(LIST_URL) + .set('kbn-xsrf', 'true') + .send(updatedList) + .expect(200); + + const outputList: Partial = { + ...getListResponseMockWithoutAutoGeneratedValues(), + name: 'some other name', + version: 2, + }; + const bodyToCompare = removeListServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(outputList); + }); + + it('should update a single list property of name using an auto-generated id', async () => { + const { id, ...listNoId } = getCreateMinimalListSchemaMock(); + // create a simple list with no id which will use an auto-generated id + const { body: createListBody } = await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(listNoId) + .expect(200); + + // update a simple list's name + const updatedList: UpdateListSchema = { + ...getUpdateMinimalListSchemaMock(), + id: createListBody.id, + name: 'some other name', + }; + const { body } = await supertest + .put(LIST_URL) + .set('kbn-xsrf', 'true') + .send(updatedList) + .expect(200); + + const outputList: Partial = { + ...getListResponseMockWithoutAutoGeneratedValues(), + name: 'some other name', + version: 2, + }; + const bodyToCompare = removeListServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(outputList); + }); + + it('should change the version of a list when it updates a property', async () => { + // create a simple list + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + // update a simple list property of name and description + const updatedList: UpdateListSchema = { + ...getUpdateMinimalListSchemaMock(), + name: 'some other name', + description: 'some other description', + }; + + const { body } = await supertest.put(LIST_URL).set('kbn-xsrf', 'true').send(updatedList); + + const outputList: Partial = { + ...getListResponseMockWithoutAutoGeneratedValues(), + name: 'some other name', + description: 'some other description', + version: 2, + }; + + const bodyToCompare = removeListServerGeneratedProperties(body); + expect(bodyToCompare).to.eql(outputList); + }); + + it('should give a 404 if it is given a fake id', async () => { + const simpleList: UpdateListSchema = { + ...getUpdateMinimalListSchemaMock(), + id: '5096dec6-b6b9-4d8d-8f93-6c2602079d9d', + }; + const { body } = await supertest + .put(LIST_URL) + .set('kbn-xsrf', 'true') + .send(simpleList) + .expect(404); + + expect(body).to.eql({ + status_code: 404, + message: 'list id: "5096dec6-b6b9-4d8d-8f93-6c2602079d9d" not found', + }); + }); + }); + }); +}; diff --git a/x-pack/test/lists_api_integration/utils.ts b/x-pack/test/lists_api_integration/utils.ts new file mode 100644 index 00000000000000..272768fdf50b30 --- /dev/null +++ b/x-pack/test/lists_api_integration/utils.ts @@ -0,0 +1,126 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { SuperTest } from 'supertest'; +import supertestAsPromised from 'supertest-as-promised'; + +import { ListItemSchema } from '../../plugins/lists/common/schemas'; +import { ListSchema } from '../../plugins/lists/common'; +import { LIST_INDEX } from '../../plugins/lists/common/constants'; + +/** + * Creates the lists and lists items index for use inside of beforeEach blocks of tests + * This will retry 20 times before giving up and hopefully still not interfere with other tests + * @param supertest The supertest client library + */ +export const createListsIndex = async ( + supertest: SuperTest, + retryCount = 20 +): Promise => { + if (retryCount > 0) { + try { + await supertest.post(LIST_INDEX).set('kbn-xsrf', 'true').send(); + } catch (err) { + // eslint-disable-next-line no-console + console.log( + `Failure trying to create the lists index, retries left are: ${retryCount - 1}`, + err + ); + await createListsIndex(supertest, retryCount - 1); + } + } else { + // eslint-disable-next-line no-console + console.log('Could not createListsIndex, no retries are left'); + } +}; + +/** + * Deletes the lists index for use inside of afterEach blocks of tests + * @param supertest The supertest client library + */ +export const deleteListsIndex = async ( + supertest: SuperTest, + retryCount = 20 +): Promise => { + if (retryCount > 0) { + try { + await supertest.delete(LIST_INDEX).set('kbn-xsrf', 'true').send(); + } catch (err) { + // eslint-disable-next-line no-console + console.log(`Failure trying to deleteListsIndex, retries left are: ${retryCount - 1}`, err); + await deleteListsIndex(supertest, retryCount - 1); + } + } else { + // eslint-disable-next-line no-console + console.log('Could not deleteListsIndex, no retries are left'); + } +}; + +/** + * This will remove server generated properties such as date times, etc... + * @param list List to pass in to remove typical server generated properties + */ +export const removeListServerGeneratedProperties = ( + list: Partial +): Partial => { + /* eslint-disable-next-line @typescript-eslint/naming-convention */ + const { created_at, updated_at, id, tie_breaker_id, _version, ...removedProperties } = list; + return removedProperties; +}; + +/** + * This will remove server generated properties such as date times, etc... + * @param list List to pass in to remove typical server generated properties + */ +export const removeListItemServerGeneratedProperties = ( + list: Partial +): Partial => { + /* eslint-disable-next-line @typescript-eslint/naming-convention */ + const { created_at, updated_at, id, tie_breaker_id, _version, ...removedProperties } = list; + return removedProperties; +}; + +// Similar to ReactJs's waitFor from here: https://testing-library.com/docs/dom-testing-library/api-async#waitfor +export const waitFor = async ( + functionToTest: () => Promise, + maxTimeout: number = 5000, + timeoutWait: number = 10 +) => { + await new Promise(async (resolve, reject) => { + let found = false; + let numberOfTries = 0; + while (!found && numberOfTries < Math.floor(maxTimeout / timeoutWait)) { + const itPasses = await functionToTest(); + if (itPasses) { + found = true; + } else { + numberOfTries++; + } + await new Promise((resolveTimeout) => setTimeout(resolveTimeout, timeoutWait)); + } + if (found) { + resolve(); + } else { + reject(new Error('timed out waiting for function condition to be true')); + } + }); +}; + +/** + * Useful for export_api testing to convert from a multi-part binary back to a string + * @param res Response + * @param callback Callback + */ +export const binaryToString = (res: any, callback: any): void => { + res.setEncoding('binary'); + res.data = ''; + res.on('data', (chunk: any) => { + res.data += chunk; + }); + res.on('end', () => { + callback(null, Buffer.from(res.data)); + }); +}; diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts index 85d0e56231643e..0037c39b8fed2c 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts @@ -13,14 +13,14 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { const esArchiver = getService('esArchiver'); const testSubjects = getService('testSubjects'); - describe('host list', function () { + describe('endpoint list', function () { this.tags('ciGroup7'); const sleep = (ms = 100) => new Promise((resolve) => setTimeout(resolve, ms)); describe('when there is data,', () => { before(async () => { await esArchiver.load('endpoint/metadata/api_feature', { useCreate: true }); - await pageObjects.endpoint.navigateToHostList(); + await pageObjects.endpoint.navigateToEndpointList(); }); after(async () => { await deleteMetadataStream(getService); @@ -28,14 +28,14 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { it('finds page title', async () => { const title = await testSubjects.getVisibleText('pageViewHeaderLeftTitle'); - expect(title).to.equal('Hosts'); + expect(title).to.equal('Endpoints'); }); it('displays table data', async () => { const expectedData = [ [ 'Hostname', - 'Host Status', + 'Agent Status', 'Integration', 'Configuration Status', 'Operating System', @@ -74,70 +74,76 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { 'Jan 24, 2020 @ 16:06:09.541', ], ]; - const tableData = await pageObjects.endpointPageUtils.tableData('hostListTable'); + const tableData = await pageObjects.endpointPageUtils.tableData('endpointListTable'); expect(tableData).to.eql(expectedData); }); it('does not show the details flyout initially', async () => { - await testSubjects.missingOrFail('hostDetailsFlyout'); + await testSubjects.missingOrFail('endpointDetailsFlyout'); }); describe('when the hostname is clicked on,', () => { it('display the details flyout', async () => { await (await testSubjects.find('hostnameCellLink')).click(); - await testSubjects.existOrFail('hostDetailsUpperList'); - await testSubjects.existOrFail('hostDetailsLowerList'); + await testSubjects.existOrFail('endpointDetailsUpperList'); + await testSubjects.existOrFail('endpointDetailsLowerList'); }); it('updates the details flyout when a new hostname is selected from the list', async () => { - // display flyout for the first host in the list + // display flyout for the first endpoint in the list await (await testSubjects.findAll('hostnameCellLink'))[0].click(); - await testSubjects.existOrFail('hostDetailsFlyoutTitle'); - const hostDetailTitle0 = await testSubjects.getVisibleText('hostDetailsFlyoutTitle'); - // select the 2nd host in the host list + await testSubjects.existOrFail('endpointDetailsFlyoutTitle'); + const endpointDetailTitle0 = await testSubjects.getVisibleText( + 'endpointDetailsFlyoutTitle' + ); + // select the 2nd endpoint in the endpoint list await (await testSubjects.findAll('hostnameCellLink'))[1].click(); await pageObjects.endpoint.waitForVisibleTextToChange( - 'hostDetailsFlyoutTitle', - hostDetailTitle0 + 'endpointDetailsFlyoutTitle', + endpointDetailTitle0 + ); + const endpointDetailTitle1 = await testSubjects.getVisibleText( + 'endpointDetailsFlyoutTitle' ); - const hostDetailTitle1 = await testSubjects.getVisibleText('hostDetailsFlyoutTitle'); - expect(hostDetailTitle1).to.not.eql(hostDetailTitle0); + expect(endpointDetailTitle1).to.not.eql(endpointDetailTitle0); }); it('has the same flyout info when the same hostname is selected', async () => { - // display flyout for the first host in the list + // display flyout for the first endpoint in the list await (await testSubjects.findAll('hostnameCellLink'))[1].click(); - await testSubjects.existOrFail('hostDetailsFlyoutTitle'); - const hostDetailTitleInitial = await testSubjects.getVisibleText( - 'hostDetailsFlyoutTitle' + await testSubjects.existOrFail('endpointDetailsFlyoutTitle'); + const endpointDetailTitleInitial = await testSubjects.getVisibleText( + 'endpointDetailsFlyoutTitle' ); - // select the same host in the host list + // select the same endpoint in the endpoint list await (await testSubjects.findAll('hostnameCellLink'))[1].click(); await sleep(500); // give page time to refresh and verify it did not change - const hostDetailTitleNew = await testSubjects.getVisibleText('hostDetailsFlyoutTitle'); - expect(hostDetailTitleNew).to.equal(hostDetailTitleInitial); + const endpointDetailTitleNew = await testSubjects.getVisibleText( + 'endpointDetailsFlyoutTitle' + ); + expect(endpointDetailTitleNew).to.equal(endpointDetailTitleInitial); }); // The integration does not work properly yet. Skipping this test for now. it.skip('navigates to ingest fleet when the Reassign Configuration link is clicked', async () => { await (await testSubjects.find('hostnameCellLink')).click(); - await (await testSubjects.find('hostDetailsLinkToIngest')).click(); + await (await testSubjects.find('endpointDetailsLinkToIngest')).click(); await testSubjects.existOrFail('fleetAgentListTable'); }); }); // This set of tests fails the flyout does not open in the before() and will be fixed in soon - describe.skip('has a url with a host id', () => { + describe.skip("has a url with an endpoint host's id", () => { before(async () => { - await pageObjects.endpoint.navigateToHostList( + await pageObjects.endpoint.navigateToEndpointList( 'selected_host=fc0ff548-feba-41b6-8367-65e8790d0eaf' ); }); it('shows a flyout', async () => { - await testSubjects.existOrFail('hostDetailsFlyoutBody'); - await testSubjects.existOrFail('hostDetailsUpperList'); - await testSubjects.existOrFail('hostDetailsLowerList'); + await testSubjects.existOrFail('endpointDetailsFlyoutBody'); + await testSubjects.existOrFail('endpointDetailsUpperList'); + await testSubjects.existOrFail('endpointDetailsLowerList'); }); it('displays details row headers', async () => { @@ -151,13 +157,15 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { 'Hostname', 'Sensor Version', ]; - const keys = await pageObjects.endpoint.hostFlyoutDescriptionKeys('hostDetailsFlyout'); + const keys = await pageObjects.endpoint.endpointFlyoutDescriptionKeys( + 'endpointDetailsFlyout' + ); expect(keys).to.eql(expectedData); }); it('displays details row descriptions', async () => { - const values = await pageObjects.endpoint.hostFlyoutDescriptionValues( - 'hostDetailsFlyout' + const values = await pageObjects.endpoint.endpointFlyoutDescriptionValues( + 'endpointDetailsFlyout' ); expect(values).to.eql([ @@ -178,7 +186,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { before(async () => { // clear out the data and reload the page await deleteMetadataStream(getService); - await pageObjects.endpoint.navigateToHostList(); + await pageObjects.endpoint.navigateToEndpointList(); }); it('displays empty Policy Table page.', async () => { await testSubjects.existOrFail('emptyPolicyTable'); diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts index 02f893029f8191..1119906ba5cfad 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts @@ -81,7 +81,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await pageObjects.policy.confirmAndSave(); await testSubjects.existOrFail('policyDetailsSuccessMessage'); - await pageObjects.endpoint.navigateToHostList(); + await pageObjects.endpoint.navigateToEndpointList(); await pageObjects.policy.navigateToPolicyDetails(policyInfo.packageConfig.id); expect(await (await testSubjects.find('policyWindowsEvent_process')).isSelected()).to.equal( diff --git a/x-pack/test/security_solution_endpoint/page_objects/endpoint_page.ts b/x-pack/test/security_solution_endpoint/page_objects/endpoint_page.ts index ae4320fc5395f9..f89ee5fe2729bc 100644 --- a/x-pack/test/security_solution_endpoint/page_objects/endpoint_page.ts +++ b/x-pack/test/security_solution_endpoint/page_objects/endpoint_page.ts @@ -14,12 +14,12 @@ export function EndpointPageProvider({ getService, getPageObjects }: FtrProvider return { /** - * Navigate to the Hosts list page + * Navigate to the Endpoints list page */ - async navigateToHostList(searchParams?: string) { + async navigateToEndpointList(searchParams?: string) { await pageObjects.common.navigateToUrlWithBrowserHistory( 'securitySolutionManagement', - `/hosts${searchParams ? `?${searchParams}` : ''}` + `/endpoints${searchParams ? `?${searchParams}` : ''}` ); await pageObjects.header.waitUntilLoadingHasFinished(); }, @@ -51,7 +51,7 @@ export function EndpointPageProvider({ getService, getPageObjects }: FtrProvider }); }, - async hostFlyoutDescriptionKeys(dataTestSubj: string) { + async endpointFlyoutDescriptionKeys(dataTestSubj: string) { await testSubjects.exists(dataTestSubj); const detailsData: WebElementWrapper = await testSubjects.find(dataTestSubj); const $ = await detailsData.parseDomContent(); @@ -65,7 +65,7 @@ export function EndpointPageProvider({ getService, getPageObjects }: FtrProvider ); }, - async hostFlyoutDescriptionValues(dataTestSubj: string) { + async endpointFlyoutDescriptionValues(dataTestSubj: string) { await testSubjects.exists(dataTestSubj); const detailsData: WebElementWrapper = await testSubjects.find(dataTestSubj); const $ = await detailsData.parseDomContent(); diff --git a/yarn.lock b/yarn.lock index 6f82c8126ac06b..7731d2f7a8ea19 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3026,10 +3026,10 @@ resolved "https://registry.yarnpkg.com/@mapbox/geojson-types/-/geojson-types-1.0.2.tgz#9aecf642cb00eab1080a57c4f949a65b4a5846d6" integrity sha512-e9EBqHHv3EORHrSfbR9DqecPNn+AmuAoQxV6aL8Xu30bJMJR1o8PZLZzpk1Wq7/NfCbuhmakHTPYRhoqLsXRnw== -"@mapbox/geojsonhint@^2.0.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@mapbox/geojsonhint/-/geojsonhint-2.2.0.tgz#75ca94706e9a56e6debf4e1c78fabdc67978b883" - integrity sha512-8qQYRB+/2z2JsN5s6D0WAnpo69+3V3nvJsSFLwMB1dsaWz1V4oZeuoje9srbYAxxL8PXCwIywfhYa3GxOkBv5Q== +"@mapbox/geojsonhint@3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@mapbox/geojsonhint/-/geojsonhint-3.0.0.tgz#42448232ce4236cb89c1b69c36b0cadeac99e02e" + integrity sha512-zHcyh1rDHYnEBd6NvOWoeHLuvazlDkIjvz9MJx4cKwcKTlfrqgxVnTv1QLnVJnsSU5neJnhQJcgscR/Zl4uYgw== dependencies: concat-stream "^1.6.1" jsonlint-lines "1.7.1" @@ -3042,16 +3042,17 @@ resolved "https://registry.yarnpkg.com/@mapbox/jsonlint-lines-primitives/-/jsonlint-lines-primitives-2.0.2.tgz#ce56e539f83552b58d10d672ea4d6fc9adc7b234" integrity sha1-zlblOfg1UrWNENZy6k1vya3HsjQ= -"@mapbox/mapbox-gl-draw@^1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@mapbox/mapbox-gl-draw/-/mapbox-gl-draw-1.1.2.tgz#247b3f0727db34c2641ab718df5eebeee69a2585" - integrity sha512-DWtATUAnJaGZYoH/y2O+QTRybxrp5y3w3eV5FXHFNVcKsCAojKEMB8ALKUG2IsiCKqV/JCAguK9AlPWR7Bjafw== +"@mapbox/mapbox-gl-draw@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@mapbox/mapbox-gl-draw/-/mapbox-gl-draw-1.2.0.tgz#b6e5278afef65bd5d7d92366034997768e478ad9" + integrity sha512-gMrP2zn8PzDtrs72FMJTPytCumX5vUn9R7IK38qBOVy9UfqbdWr56KYuNA/2X+jKn4FIOpmWf8CWkKpOaQkv7w== dependencies: "@mapbox/geojson-area" "^0.2.1" "@mapbox/geojson-extent" "^0.3.2" "@mapbox/geojson-normalize" "0.0.1" - "@mapbox/geojsonhint" "^2.0.0" + "@mapbox/geojsonhint" "3.0.0" "@mapbox/point-geometry" "0.1.0" + eslint-plugin-import "^2.19.1" hat "0.0.3" lodash.isequal "^4.2.0" xtend "^4.0.1" @@ -9905,14 +9906,14 @@ collection-visit@^1.0.0: map-visit "^1.0.0" object-visit "^1.0.0" -color-convert@^1.8.2, color-convert@^1.9.0: +color-convert@^1.8.2: version "1.9.1" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed" integrity sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ== dependencies: color-name "^1.1.1" -color-convert@^1.9.1: +color-convert@^1.9.0, color-convert@^1.9.1: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== @@ -28888,14 +28889,14 @@ supports-color@^3.1.2: dependencies: has-flag "^1.0.0" -supports-color@^5.0.0, supports-color@^5.4.0, supports-color@^5.5.0: +supports-color@^5.0.0, supports-color@^5.3.0, supports-color@^5.4.0, supports-color@^5.5.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== dependencies: has-flag "^3.0.0" -supports-color@^5.2.0, supports-color@^5.3.0: +supports-color@^5.2.0: version "5.3.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.3.0.tgz#5b24ac15db80fa927cf5227a4a33fd3c4c7676c0" integrity sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==