Downgrade to query-string v5.1.1 (#59633)

* Downgrade to query-string v5.1.1

* update lib version for x-pack

* fix JEST

* fix functional tests

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Alexey Antonov 2020-03-13 17:27:09 +03:00 committed by GitHub
parent c6ec5d4395
commit 9d00427aef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 141 additions and 35 deletions

View file

@ -226,7 +226,7 @@
"prop-types": "15.6.0",
"proxy-from-env": "1.0.0",
"pug": "^2.0.4",
"query-string": "6.10.1",
"query-string": "5.1.1",
"raw-loader": "3.1.0",
"re2": "1.10.5",
"react": "^16.12.0",

46
test/typings/query_string.d.ts vendored Normal file
View file

@ -0,0 +1,46 @@
/*
* 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.
*/
declare module 'query-string' {
type ArrayFormat = 'bracket' | 'index' | 'none';
export interface ParseOptions {
arrayFormat?: ArrayFormat;
sort: ((itemLeft: string, itemRight: string) => number) | false;
}
export interface ParsedQuery<T = string> {
[key: string]: T | T[] | null | undefined;
}
export function parse(str: string, options?: ParseOptions): ParsedQuery;
export function parseUrl(str: string, options?: ParseOptions): { url: string; query: any };
export interface StringifyOptions {
strict?: boolean;
encode?: boolean;
arrayFormat?: ArrayFormat;
sort: ((itemLeft: string, itemRight: string) => number) | false;
}
export function stringify(obj: object, options?: StringifyOptions): string;
export function extract(str: string): string;
}

46
typings/query_string.d.ts vendored Normal file
View file

@ -0,0 +1,46 @@
/*
* 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.
*/
declare module 'query-string' {
type ArrayFormat = 'bracket' | 'index' | 'none';
export interface ParseOptions {
arrayFormat?: ArrayFormat;
sort: ((itemLeft: string, itemRight: string) => number) | false;
}
export interface ParsedQuery<T = string> {
[key: string]: T | T[] | null | undefined;
}
export function parse(str: string, options?: ParseOptions): ParsedQuery;
export function parseUrl(str: string, options?: ParseOptions): { url: string; query: any };
export interface StringifyOptions {
strict?: boolean;
encode?: boolean;
arrayFormat?: ArrayFormat;
sort: ((itemLeft: string, itemRight: string) => number) | false;
}
export function stringify(obj: object, options?: StringifyOptions): string;
export function extract(str: string): string;
}

View file

@ -90,9 +90,9 @@ describe('fromQuery and toQuery', () => {
expect(
fromQuery(
toQuery(
'?name=john%20doe&rangeFrom=2019-03-03T12:00:00.000Z&path=a%2Fb'
'?name=john%20doe&path=a%2Fb&rangeFrom=2019-03-03T12:00:00.000Z'
)
)
).toEqual('name=john%20doe&rangeFrom=2019-03-03T12:00:00.000Z&path=a%2Fb');
).toEqual('name=john%20doe&path=a%2Fb&rangeFrom=2019-03-03T12:00:00.000Z');
});
});

View file

@ -114,7 +114,7 @@ describe('useUrlParams', () => {
expect(history.push).toHaveBeenCalledWith({
pathname: '/',
search: 'g=%22%22&dateRangeStart=now-12&dateRangeEnd=now',
search: 'dateRangeEnd=now&dateRangeStart=now-12&g=%22%22',
});
});
});

View file

@ -296,7 +296,7 @@
"proper-lockfile": "^3.2.0",
"puid": "1.0.7",
"puppeteer-core": "^1.19.0",
"query-string": "6.10.1",
"query-string": "5.1.1",
"raw-loader": "3.1.0",
"re-resizable": "^6.1.1",
"react": "^16.12.0",

View file

@ -19,7 +19,7 @@ describe('RedirectToLogs component', () => {
expect(component).toMatchInlineSnapshot(`
<Redirect
to="/stream?sourceId=default&logPosition=(position:(tiebreaker:0,time:1550671089404),streamLive:!f)&logFilter=(expression:'',kind:kuery)"
to="/stream?logPosition=(position:(tiebreaker:0,time:1550671089404),streamLive:!f)&sourceId=default&logFilter=(expression:'',kind:kuery)"
/>
`);
});
@ -33,7 +33,7 @@ describe('RedirectToLogs component', () => {
expect(component).toMatchInlineSnapshot(`
<Redirect
to="/stream?sourceId=default&logPosition=(position:(tiebreaker:0,time:1550671089404),streamLive:!f)&logFilter=(expression:'FILTER_FIELD:FILTER_VALUE',kind:kuery)"
to="/stream?logPosition=(position:(tiebreaker:0,time:1550671089404),streamLive:!f)&sourceId=default&logFilter=(expression:'FILTER_FIELD:FILTER_VALUE',kind:kuery)"
/>
`);
});

View file

@ -73,7 +73,7 @@ describe('RedirectToNodeLogs component', () => {
expect(component).toMatchInlineSnapshot(`
<Redirect
to="/?sourceId=default&logPosition=(position:(tiebreaker:0,time:1550671089404),streamLive:!f)&logFilter=(expression:'HOST_FIELD:%20HOST_NAME',kind:kuery)"
to="/?logPosition=(position:(tiebreaker:0,time:1550671089404),streamLive:!f)&sourceId=default&logFilter=(expression:'HOST_FIELD:%20HOST_NAME',kind:kuery)"
/>
`);
});
@ -89,7 +89,7 @@ describe('RedirectToNodeLogs component', () => {
expect(component).toMatchInlineSnapshot(`
<Redirect
to="/?sourceId=default&logPosition=(position:(tiebreaker:0,time:1550671089404),streamLive:!f)&logFilter=(expression:'(HOST_FIELD:%20HOST_NAME)%20and%20(FILTER_FIELD:FILTER_VALUE)',kind:kuery)"
to="/?logPosition=(position:(tiebreaker:0,time:1550671089404),streamLive:!f)&sourceId=default&logFilter=(expression:'(HOST_FIELD:%20HOST_NAME)%20and%20(FILTER_FIELD:FILTER_VALUE)',kind:kuery)"
/>
`);
});

View file

@ -22,7 +22,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
state: undefined,
};
const expectedSearchString =
"sourceId=default&logPosition=(position:(tiebreaker:0,time:1565707203194),streamLive:!f)&logFilter=(expression:'trace.id:433b4651687e18be2c6c8e3b11f53d09',kind:kuery)";
"logFilter=(expression:'trace.id:433b4651687e18be2c6c8e3b11f53d09',kind:kuery)&logPosition=(position:(tiebreaker:0,time:1565707203194),streamLive:!f)&sourceId=default";
const expectedRedirectPath = '/logs/stream?';
await pageObjects.common.navigateToUrlWithBrowserHistory(

33
x-pack/typings/query_string.d.ts vendored Normal file
View file

@ -0,0 +1,33 @@
/*
* 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.
*/
declare module 'query-string' {
type ArrayFormat = 'bracket' | 'index' | 'none';
export interface ParseOptions {
arrayFormat?: ArrayFormat;
sort?: ((itemLeft: string, itemRight: string) => number) | false;
}
export interface ParsedQuery<T = string> {
[key: string]: T | T[] | null | undefined;
}
export function parse(str: string, options?: ParseOptions): ParsedQuery;
export function parseUrl(str: string, options?: ParseOptions): { url: string; query: any };
export interface StringifyOptions {
strict?: boolean;
encode?: boolean;
arrayFormat?: ArrayFormat;
sort?: ((itemLeft: string, itemRight: string) => number) | false;
}
export function stringify(obj: object, options?: StringifyOptions): string;
export function extract(str: string): string;
}

View file

@ -23951,14 +23951,14 @@ qs@~6.4.0:
resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233"
integrity sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=
query-string@6.10.1:
version "6.10.1"
resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.10.1.tgz#30b3505f6fca741d5ae541964d1b3ae9dc2a0de8"
integrity sha512-SHTUV6gDlgMXg/AQUuLpTiBtW/etZ9JT6k6RCtCyqADquApLX0Aq5oK/s5UeTUAWBG50IExjIr587GqfXRfM4A==
query-string@5.1.1, query-string@^5.0.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/query-string/-/query-string-5.1.1.tgz#a78c012b71c17e05f2e3fa2319dd330682efb3cb"
integrity sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==
dependencies:
decode-uri-component "^0.2.0"
split-on-first "^1.0.0"
strict-uri-encode "^2.0.0"
object-assign "^4.1.0"
strict-uri-encode "^1.0.0"
query-string@^4.1.0, query-string@^4.2.2:
version "4.3.4"
@ -23968,15 +23968,6 @@ query-string@^4.1.0, query-string@^4.2.2:
object-assign "^4.1.0"
strict-uri-encode "^1.0.0"
query-string@^5.0.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/query-string/-/query-string-5.1.1.tgz#a78c012b71c17e05f2e3fa2319dd330682efb3cb"
integrity sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==
dependencies:
decode-uri-component "^0.2.0"
object-assign "^4.1.0"
strict-uri-encode "^1.0.0"
querystring-es3@^0.2.0:
version "0.2.1"
resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73"
@ -27588,11 +27579,6 @@ spdy@^4.0.1:
select-hose "^2.0.0"
spdy-transport "^3.0.0"
split-on-first@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/split-on-first/-/split-on-first-1.1.0.tgz#f610afeee3b12bce1d0c30425e76398b78249a5f"
integrity sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==
split-string@^3.0.1, split-string@^3.0.2:
version "3.1.0"
resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2"
@ -27901,11 +27887,6 @@ strict-uri-encode@^1.0.0:
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713"
integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=
strict-uri-encode@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546"
integrity sha1-ucczDHBChi9rFC3CdLvMWGbONUY=
string-length@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/string-length/-/string-length-1.0.1.tgz#56970fb1c38558e9e70b728bf3de269ac45adfac"