From 5748ce8d1ae7d499a7c2aaa9d00a867ccb044178 Mon Sep 17 00:00:00 2001 From: Rostislav Provodenko Date: Wed, 2 Jun 2021 13:05:39 +0300 Subject: [PATCH 1/6] wip --- addon/result_iterator.cc | 23 ++++++++++++++++++++- src/tests/data-types.test.ts | 7 +++++++ src/tests/test-fixtures/crawl_urls.parquet | Bin 0 -> 56172 bytes 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/tests/test-fixtures/crawl_urls.parquet diff --git a/addon/result_iterator.cc b/addon/result_iterator.cc index a0db6f3..c46f476 100644 --- a/addon/result_iterator.cc +++ b/addon/result_iterator.cc @@ -146,7 +146,6 @@ Napi::Value ResultIterator::getCellValue(Napi::Env env, duckdb::idx_t col_idx) { if (val.is_null) { return env.Null(); } - switch (result->types[col_idx].id()) { case duckdb::LogicalTypeId::BOOLEAN: return Napi::Boolean::New(env, val.GetValue()); @@ -210,7 +209,29 @@ Napi::Value ResultIterator::getCellValue(Napi::Env env, duckdb::idx_t col_idx) { case duckdb::LogicalTypeId::UINTEGER: // GetValue is not supported for uint32_t, so using the wider type return Napi::Number::New(env, val.GetValue()); + case duckdb::LogicalTypeId::LIST: { + auto return_array = Napi::Array::New(env); + cout << "dsadsads" << endl; + cout << val.ToString() << endl; + + for (size_t i = 0; i < val.list_value.size(); i++) { + auto &child = val.list_value[i]; + if (child.type().id() == duckdb::LogicalTypeId::STRUCT) { + auto object = Napi::Object::New(env); + for (size_t t = 0; t < child.struct_value.size(); t++) { + auto &name = child.type().child_types()[t].first; + auto &subchild = child.struct_value[t]; + object.Set(name, subchild.ToString()); + } + return_array.Set(i, object); + } + cout << child.ToString() << endl; + } + + return return_array; + } default: + cout << "321312321" << endl; // default to getting string representation return Napi::String::New(env, val.ToString()); } diff --git a/src/tests/data-types.test.ts b/src/tests/data-types.test.ts index 6f07ac3..b97f6f9 100644 --- a/src/tests/data-types.test.ts +++ b/src/tests/data-types.test.ts @@ -220,4 +220,11 @@ describe("Data type mapping", () => { expect(result.fetchRow()).toMatchObject([1]); }); + + + it.only("supports MAP", async () => { + const result = await connection.executeIterator(`SELECT raw_header from parquet_scan('src/tests/test-fixtures/crawl_urls.parquet')`); + console.log(result.fetchRow()); + expect(result.fetchRow()).toEqual(["2000-05-05"]); + }); }); diff --git a/src/tests/test-fixtures/crawl_urls.parquet b/src/tests/test-fixtures/crawl_urls.parquet new file mode 100644 index 0000000000000000000000000000000000000000..ccc37b197118405183bb62a22b00d36752cac4b0 GIT binary patch literal 56172 zcmeHw2V7HE*!K+tWQm9*1}9dHSY?H&#Q}=4WT^-^AdmnNNH7V@Nv&4g7Wb?JweCGj z-2-v&y%num>)zV$Id|pW#ii|Uf$7U8Dq&@m=9$5&CH4ax4C?5mK*r{?6wcL~!3_yq;|^yuEo z-6t=&ORiUXM{Sf>_Y}EjZfZudSBOff_3jtdLY^0;@N<*O0@}0@V(`~+v<3PP!%Tah z+%#oDFgE=9l|eriSey7eXpZoQ+YE2-XIZ!UF3V=anqNAp8gVgH`Nr(!yT1kx8ub3n zoj+fm@W;FwzdO?*eA%6K#j8e)N$Yr~UZ<(&x~|H<^uwv{-;|I2Ej+vFCa>{%%QemX zE?duNJhcsP#Oy1_C)A2;96P_~yo`P4JnLjUdvx^Yzv?!h-nPvfS@->Bb!#7u49YpW zw%a$)Hty)TBP03d^J$H)6}Q_W@HyRh$1@X_s1OKgrHb^$o3^YXkoU@s}Z$qtGWh-7w{VqR$kkMnbxo`dT?+;%5 z(``_w@2;f}?sRH%u=$V{zdT=4r+aOI^UG#YjaOzJs5{c(*wj1coToMKvVQAQ|8dO{ zRY6VLeQ>{0W07N4&AlDZ?z-{EloQ@fmuKD0S=7OK``fdd%FaHqOKMhq!bQh<^}_SN zJ25%od%Md$;$C?lST%UQtnrKfTTTwG(P2nEt2%GpzMDI4r2X4@+e9-Kx!Bq#%??Oz z&(Aro{9!=@zwI{5T!#$r(qKgBz_qtZA67f)m)=ig+xDl+r7IWY`EC}p8#}Q?l5*!4 z54n}1#quN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OgSTC*Hi6A+k~@Vhn*mU4n02?(UR!pfYE z;qve<2;fj}^=``(S1e@;sl+##P6)t3h~9;G;-$+$2vzxwyD-B=p;iDKRyCfsf)Np& z_cBfwXS( Date: Wed, 2 Jun 2021 13:52:46 +0300 Subject: [PATCH 2/6] list and struct --- addon/result_iterator.cc | 90 ++++++++++++++++++------------------ addon/result_iterator.h | 1 + src/tests/data-types.test.ts | 66 ++++++++++++++++++++++++-- 3 files changed, 109 insertions(+), 48 deletions(-) diff --git a/addon/result_iterator.cc b/addon/result_iterator.cc index c46f476..b59c23c 100644 --- a/addon/result_iterator.cc +++ b/addon/result_iterator.cc @@ -141,28 +141,32 @@ Napi::Value ResultIterator::getRowObject(Napi::Env env) { } Napi::Value ResultIterator::getCellValue(Napi::Env env, duckdb::idx_t col_idx) { - auto val = current_chunk->data[col_idx].GetValue(chunk_offset); + auto value = current_chunk->data[col_idx].GetValue(chunk_offset); + return getMappedValue(env, value); +} - if (val.is_null) { +Napi::Value ResultIterator::getMappedValue(Napi::Env env, duckdb::Value value) { + if (value.is_null) { return env.Null(); } - switch (result->types[col_idx].id()) { + + switch (value.type().id()) { case duckdb::LogicalTypeId::BOOLEAN: - return Napi::Boolean::New(env, val.GetValue()); + return Napi::Boolean::New(env, value.GetValue()); case duckdb::LogicalTypeId::TINYINT: - return Napi::Number::New(env, val.GetValue()); + return Napi::Number::New(env, value.GetValue()); case duckdb::LogicalTypeId::SMALLINT: - return Napi::Number::New(env, val.GetValue()); + return Napi::Number::New(env, value.GetValue()); case duckdb::LogicalTypeId::INTEGER: - return Napi::Number::New(env, val.GetValue()); + return Napi::Number::New(env, value.GetValue()); case duckdb::LogicalTypeId::BIGINT: - return Napi::BigInt::New(env, val.GetValue()); + return Napi::BigInt::New(env, value.GetValue()); case duckdb::LogicalTypeId::HUGEINT: { // hugeint_t represents a signed 128 bit integer in two's complement // notation napi's BigInt is basically a regular signed integer (MSB) so we // want to make sure we pass the absolute value of the huge int into napi // plus the sign bit - auto huge_int = val.GetValue(); + auto huge_int = value.GetValue(); int is_negative = huge_int.upper < 0; duckdb::hugeint_t positive_huge_int = is_negative ? huge_int * duckdb::hugeint_t(-1) : huge_int; @@ -170,72 +174,70 @@ Napi::Value ResultIterator::getCellValue(Napi::Env env, duckdb::idx_t col_idx) { return Napi::BigInt::New(env, is_negative, 2, &arr[0]); } case duckdb::LogicalTypeId::FLOAT: - return Napi::Number::New(env, val.GetValue()); + return Napi::Number::New(env, value.GetValue()); case duckdb::LogicalTypeId::DOUBLE: - return Napi::Number::New(env, val.GetValue()); + return Napi::Number::New(env, value.GetValue()); case duckdb::LogicalTypeId::DECIMAL: return Napi::Number::New( - env, val.CastAs(duckdb::LogicalType::DOUBLE).GetValue()); + env, value.CastAs(duckdb::LogicalType::DOUBLE).GetValue()); case duckdb::LogicalTypeId::VARCHAR: - return Napi::String::New(env, val.GetValue()); + return Napi::String::New(env, value.GetValue()); case duckdb::LogicalTypeId::BLOB: { - int array_length = val.str_value.length(); + int array_length = value.str_value.length(); char char_array[array_length + 1]; // TODO: multiple copies, improve - strcpy(char_array, val.str_value.c_str()); + strcpy(char_array, value.str_value.c_str()); return Napi::Buffer::Copy(env, char_array, array_length); } case duckdb::LogicalTypeId::TIMESTAMP: { - if (result->types[col_idx].InternalType() != duckdb::PhysicalType::INT64) { + if (value.type().InternalType() != duckdb::PhysicalType::INT64) { throw runtime_error("expected int64 for timestamp"); } - int64_t tval = val.GetValue(); + int64_t tval = value.GetValue(); return Napi::Number::New(env, tval / 1000); } case duckdb::LogicalTypeId::TIME: { - if (result->types[col_idx].InternalType() != duckdb::PhysicalType::INT64) { + if (value.type().InternalType() != duckdb::PhysicalType::INT64) { throw runtime_error("expected int64 for time"); } - int64_t tval = val.GetValue(); + int64_t tval = value.GetValue(); return Napi::Number::New(env, GetTime(tval)); } case duckdb::LogicalTypeId::INTERVAL: { - return Napi::String::New(env, val.ToString()); + return Napi::String::New(env, value.ToString()); } case duckdb::LogicalTypeId::UTINYINT: - return Napi::Number::New(env, val.GetValue()); + return Napi::Number::New(env, value.GetValue()); case duckdb::LogicalTypeId::USMALLINT: - return Napi::Number::New(env, val.GetValue()); + return Napi::Number::New(env, value.GetValue()); case duckdb::LogicalTypeId::UINTEGER: // GetValue is not supported for uint32_t, so using the wider type - return Napi::Number::New(env, val.GetValue()); + return Napi::Number::New(env, value.GetValue()); case duckdb::LogicalTypeId::LIST: { - auto return_array = Napi::Array::New(env); - cout << "dsadsads" << endl; - cout << val.ToString() << endl; - - for (size_t i = 0; i < val.list_value.size(); i++) { - auto &child = val.list_value[i]; - if (child.type().id() == duckdb::LogicalTypeId::STRUCT) { - auto object = Napi::Object::New(env); - for (size_t t = 0; t < child.struct_value.size(); t++) { - auto &name = child.type().child_types()[t].first; - auto &subchild = child.struct_value[t]; - object.Set(name, subchild.ToString()); - } - return_array.Set(i, object); - } - cout << child.ToString() << endl; - } - - return return_array; + auto array = Napi::Array::New(env); + for (size_t i = 0; i < value.list_value.size(); i++) { + auto &element = value.list_value[i]; + auto mapped_value = getMappedValue(env, element); + array.Set(i, mapped_value); + } + return array; + } + case duckdb::LogicalTypeId::STRUCT: { + auto object = Napi::Object::New(env); + for (size_t t = 0; t < value.struct_value.size(); t++) { + auto &key = value.type().child_types()[t].first; + auto &element = value.struct_value[t]; + auto child_value = getMappedValue(env, element); + object.Set(key, child_value); + } + return object; } default: - cout << "321312321" << endl; // default to getting string representation - return Napi::String::New(env, val.ToString()); + return Napi::String::New(env, value.ToString()); } } + Napi::Value ResultIterator::Close(const Napi::CallbackInfo &info) { result.reset(); return info.Env().Undefined(); diff --git a/addon/result_iterator.h b/addon/result_iterator.h index b168138..821ce85 100644 --- a/addon/result_iterator.h +++ b/addon/result_iterator.h @@ -26,6 +26,7 @@ class ResultIterator : public Napi::ObjectWrap { duckdb::unique_ptr current_chunk; uint64_t chunk_offset = 0; Napi::Value getCellValue(Napi::Env env, duckdb::idx_t col_idx); + Napi::Value getMappedValue(Napi::Env env, duckdb::Value duckdb_value); Napi::Value getRowArray(Napi::Env env); Napi::Value getRowObject(Napi::Env env); }; diff --git a/src/tests/data-types.test.ts b/src/tests/data-types.test.ts index b97f6f9..f795c68 100644 --- a/src/tests/data-types.test.ts +++ b/src/tests/data-types.test.ts @@ -221,10 +221,68 @@ describe("Data type mapping", () => { expect(result.fetchRow()).toMatchObject([1]); }); + it("supports LIST - integers", async () => { + const result = await connection.executeIterator(`SELECT array_slice([1,2,3], 1, NULL)`); + expect(result.fetchRow()).toMatchObject({"array_slice(list_value(1, 2, 3), 1, NULL)": [2, 3]}); + }); - it.only("supports MAP", async () => { - const result = await connection.executeIterator(`SELECT raw_header from parquet_scan('src/tests/test-fixtures/crawl_urls.parquet')`); - console.log(result.fetchRow()); - expect(result.fetchRow()).toEqual(["2000-05-05"]); + it("supports LIST - strings", async () => { + const result = await connection.executeIterator(`SELECT array_slice(['a','b','c'], 1, NULL)`); + expect(result.fetchRow()).toEqual({"array_slice(list_value(a, b, c), 1, NULL)": ["b", "c"]}); + }); + + it("supports LIST - STRUCTs", async () => { + const result = await connection.executeIterator( + `SELECT raw_header from parquet_scan('src/tests/test-fixtures/crawl_urls.parquet')`, + ); + expect(result.fetchRow()).toEqual({ + "raw_header": [ + { + "key": "Content-Encoding", + "value": "gzip", + }, + { + "key": "X-Frame-Options", + "value": "SAMEORIGIN", + }, + { + "key": "Connection", + "value": "keep-alive", + }, + { + "key": "X-Xss-Protection", + "value": "1; mode=block", + }, + { + "key": "Content-Type", + "value": "text/html;charset=utf-8", + }, + { + "key": "Date", + "value": "Tue, 18 Aug 2020 13:46:36 GMT", + }, + { + "key": "Vary", + "value": "User-agent,Accept-Encoding", + }, + { + "key": "Server", + "value": "nginx/1.10.3", + }, + { + "key": "X-Content-Type-Options", + "value": "nosniff", + }, + { + "key": "Content-Length", + "value": "1180", + }, + ], + }); + }); + + it("supports STRUCT", async () => { + const result = await connection.executeIterator(`SELECT struct_pack(i := 4, s := 'string')`); + expect(result.fetchRow()).toEqual({"struct_pack(4, string)": {"i": 4, "s": "string"}}); }); }); From 18bb2a39aec601e49db8f1303d38576903ae7499 Mon Sep 17 00:00:00 2001 From: Rostislav Provodenko Date: Wed, 2 Jun 2021 13:53:28 +0300 Subject: [PATCH 3/6] ver --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2617bb4..27f9c6b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-duckdb", - "version": "0.0.70", + "version": "0.0.71", "private": false, "description": "DuckDB for Node.JS", "keywords": [ From e3911dc916b3ef2e3dfd6184317faa8155b9618f Mon Sep 17 00:00:00 2001 From: Rostislav Provodenko Date: Wed, 2 Jun 2021 13:57:57 +0300 Subject: [PATCH 4/6] rename --- addon/result_iterator.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addon/result_iterator.cc b/addon/result_iterator.cc index b59c23c..55116b1 100644 --- a/addon/result_iterator.cc +++ b/addon/result_iterator.cc @@ -224,9 +224,9 @@ Napi::Value ResultIterator::getMappedValue(Napi::Env env, duckdb::Value value) { } case duckdb::LogicalTypeId::STRUCT: { auto object = Napi::Object::New(env); - for (size_t t = 0; t < value.struct_value.size(); t++) { - auto &key = value.type().child_types()[t].first; - auto &element = value.struct_value[t]; + for (size_t i = 0; i < value.struct_value.size(); i++) { + auto &key = value.type().child_types()[i].first; + auto &element = value.struct_value[i]; auto child_value = getMappedValue(env, element); object.Set(key, child_value); } From f51d92850dd4197d1e1658daced55a7d8183c6b0 Mon Sep 17 00:00:00 2001 From: Rostislav Provodenko Date: Wed, 2 Jun 2021 14:27:26 +0300 Subject: [PATCH 5/6] fix --- src/tests/data-types.test.ts | 48 ++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/tests/data-types.test.ts b/src/tests/data-types.test.ts index f795c68..9f114c5 100644 --- a/src/tests/data-types.test.ts +++ b/src/tests/data-types.test.ts @@ -223,12 +223,12 @@ describe("Data type mapping", () => { it("supports LIST - integers", async () => { const result = await connection.executeIterator(`SELECT array_slice([1,2,3], 1, NULL)`); - expect(result.fetchRow()).toMatchObject({"array_slice(list_value(1, 2, 3), 1, NULL)": [2, 3]}); + expect(result.fetchRow()).toMatchObject({ "array_slice(list_value(1, 2, 3), 1, NULL)": [2, 3] }); }); it("supports LIST - strings", async () => { const result = await connection.executeIterator(`SELECT array_slice(['a','b','c'], 1, NULL)`); - expect(result.fetchRow()).toEqual({"array_slice(list_value(a, b, c), 1, NULL)": ["b", "c"]}); + expect(result.fetchRow()).toEqual({ "array_slice(list_value(a, b, c), 1, NULL)": ["b", "c"] }); }); it("supports LIST - STRUCTs", async () => { @@ -236,46 +236,46 @@ describe("Data type mapping", () => { `SELECT raw_header from parquet_scan('src/tests/test-fixtures/crawl_urls.parquet')`, ); expect(result.fetchRow()).toEqual({ - "raw_header": [ + raw_header: [ { - "key": "Content-Encoding", - "value": "gzip", + key: "Content-Encoding", + value: "gzip", }, { - "key": "X-Frame-Options", - "value": "SAMEORIGIN", + key: "X-Frame-Options", + value: "SAMEORIGIN", }, { - "key": "Connection", - "value": "keep-alive", + key: "Connection", + value: "keep-alive", }, { - "key": "X-Xss-Protection", - "value": "1; mode=block", + key: "X-Xss-Protection", + value: "1; mode=block", }, { - "key": "Content-Type", - "value": "text/html;charset=utf-8", + key: "Content-Type", + value: "text/html;charset=utf-8", }, { - "key": "Date", - "value": "Tue, 18 Aug 2020 13:46:36 GMT", + key: "Date", + value: "Tue, 18 Aug 2020 13:46:36 GMT", }, { - "key": "Vary", - "value": "User-agent,Accept-Encoding", + key: "Vary", + value: "User-agent,Accept-Encoding", }, { - "key": "Server", - "value": "nginx/1.10.3", + key: "Server", + value: "nginx/1.10.3", }, { - "key": "X-Content-Type-Options", - "value": "nosniff", + key: "X-Content-Type-Options", + value: "nosniff", }, { - "key": "Content-Length", - "value": "1180", + key: "Content-Length", + value: "1180", }, ], }); @@ -283,6 +283,6 @@ describe("Data type mapping", () => { it("supports STRUCT", async () => { const result = await connection.executeIterator(`SELECT struct_pack(i := 4, s := 'string')`); - expect(result.fetchRow()).toEqual({"struct_pack(4, string)": {"i": 4, "s": "string"}}); + expect(result.fetchRow()).toEqual({ "struct_pack(4, string)": { i: 4, s: "string" } }); }); }); From 205f3b9160b9d1ed317d52a6006c7ec9d50287a2 Mon Sep 17 00:00:00 2001 From: Rostislav Provodenko Date: Wed, 2 Jun 2021 14:48:05 +0300 Subject: [PATCH 6/6] lock --- yarn.lock | 55 +++++++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/yarn.lock b/yarn.lock index 41ab08a..668f933 100644 --- a/yarn.lock +++ b/yarn.lock @@ -612,9 +612,9 @@ fastq "^1.6.0" "@npmcli/arborist@^2.3.0", "@npmcli/arborist@^2.5.0": - version "2.5.0" - resolved "https://registry.yarnpkg.com/@npmcli/arborist/-/arborist-2.5.0.tgz#3a2bf74e47b4cbe20e0983291f291a2ec2c3d06f" - integrity sha512-YPSkV/8vofpbAJyeu52J12YnC5VTkYIcfcNkRoSW6qjfQG+QybgbJtCbcdx+M0YxfdzDKS6iDTjpNMoETZ8HOA== + version "2.6.1" + resolved "https://registry.yarnpkg.com/@npmcli/arborist/-/arborist-2.6.1.tgz#bdbd1311cc857583ffc85f4d3f24a50683303dda" + integrity "sha1-vb0TEcyFdYP/yF9NPySlBoMwPdo= sha512-OOlntFIOAo7RplEQaYXlA5U5NXE+EwZtnTCsit4Wtme5+llGiea6GBytuV8dOzdPMPlNx3fQQjBUE9E8k76yjQ==" dependencies: "@npmcli/installed-package-contents" "^1.0.7" "@npmcli/map-workspaces" "^1.0.2" @@ -1815,9 +1815,9 @@ byte-size@^7.0.1: integrity sha512-crQdqyCwhokxwV1UyDzLZanhkugAgft7vt0qbbdt60C6Zf3CAiGmtUCylbtYwrU6loOUw3euGrNtW1J651ot1A== cacache@^15.0.3, cacache@^15.0.5, cacache@^15.0.6: - version "15.0.6" - resolved "https://registry.yarnpkg.com/cacache/-/cacache-15.0.6.tgz#65a8c580fda15b59150fb76bf3f3a8e45d583099" - integrity sha512-g1WYDMct/jzW+JdWEyjaX2zoBkZ6ZT9VpOyp2I/VMtDsNLffNat3kqPFfi1eDRSK9/SuKGyORDHcQMcPF8sQ/w== + version "15.2.0" + resolved "https://registry.yarnpkg.com/cacache/-/cacache-15.2.0.tgz#73af75f77c58e72d8c630a7a2858cb18ef523389" + integrity "sha1-c69193xY5y2MYwp6KFjLGO9SM4k= sha512-uKoJSHmnrqXgthDFx/IU6ED/5xd+NNGe+Bb+kLZy7Ku4P+BaiWEUflAKPZ7eAzsYGcsAGASJZsybXp+quEcHTw==" dependencies: "@npmcli/move-file" "^1.0.1" chownr "^2.0.0" @@ -3602,9 +3602,9 @@ fs.realpath@^1.0.0: integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= fsevents@^2.1.2: - version "2.3.1" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.1.tgz#b209ab14c61012636c8863507edf7fb68cc54e9f" - integrity sha512-YR47Eg4hChJGAB1O3yEAOkGO+rlzutoICGqGo9EZ4lKWokzZRSyIW1QmTzqjtw8MJdj9srP869CuWw/hyzSiBw== + version "2.3.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== fsevents@~2.1.2: version "2.1.3" @@ -4109,9 +4109,9 @@ iconv-lite@0.4.24: safer-buffer ">= 2.1.2 < 3" iconv-lite@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.2.tgz#ce13d1875b0c3a674bd6a04b7f76b01b1b6ded01" - integrity sha512-2y91h5OpQlolefMPmUlivelittSWy0rP+oYVpn6A7GwVHNE8AWzoYOBNmlwks3LobaJxgHCYZAnyNo2GgpNRNQ== + version "0.6.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" + integrity "sha1-pS+AvzjaGVLrXGgXkHGYcaGnJQE= sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==" dependencies: safer-buffer ">= 2.1.2 < 3.0.0" @@ -5360,9 +5360,9 @@ libnpmdiff@^2.0.4: tar "^6.1.0" libnpmexec@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/libnpmexec/-/libnpmexec-1.1.1.tgz#aa510cc74612cac3945f7e2fd2ac4c650fa7ef66" - integrity sha512-uw6H2dzC6F6fdq7lAxfzXPimHCJ3/g6ycFKcv2Q2QXuNZ94EDmNPpMO6f4mwiC5F6Lyy/WK0IL7AZwRhmSvUdQ== + version "1.2.0" + resolved "https://registry.yarnpkg.com/libnpmexec/-/libnpmexec-1.2.0.tgz#ab0294ab63bb599b3ac6921129b7a706d4d56da2" + integrity "sha1-qwKUq2O7WZs6xpIRKbenBtTVbaI= sha512-LkxnH2wsMUI4thsgUK0r+EFZ5iCjKlp21J68dFY7AzD5uaaIPqO3lqVvYbyl1Umz1R4rY9t3vFa1fF3hzo6Y2Q==" dependencies: "@npmcli/arborist" "^2.3.0" "@npmcli/ci-detect" "^1.3.0" @@ -6183,9 +6183,9 @@ normalize-url@^4.1.0: integrity sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ== npm-audit-report@^2.1.4: - version "2.1.4" - resolved "https://registry.yarnpkg.com/npm-audit-report/-/npm-audit-report-2.1.4.tgz#b14c4625131fb7bcacc4b1c83842af1f58c92c98" - integrity sha512-Tz7rnfskSdZ0msTzt2mENC/B+H2QI8u0jN0ck7o3zDsQYIQrek/l3MjEc+CARer+64LsVTU6ZIqNuh0X55QPhw== + version "2.1.5" + resolved "https://registry.yarnpkg.com/npm-audit-report/-/npm-audit-report-2.1.5.tgz#a5b8850abe2e8452fce976c8960dd432981737b5" + integrity "sha1-pbiFCr4uhFL86XbIlg3UMpgXN7U= sha512-YB8qOoEmBhUH1UJgh1xFAv7Jg1d+xoNhsDYiFQlEFThEBui0W1vIz2ZK6FVg4WZjwEdl7uBQlm1jy3MUfyHeEw==" dependencies: chalk "^4.0.0" @@ -6252,9 +6252,9 @@ npm-profile@^5.0.3: npm-registry-fetch "^10.0.0" npm-registry-fetch@^10.0.0, npm-registry-fetch@^10.1.1: - version "10.1.1" - resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-10.1.1.tgz#97bc7a0fca5e8f76cc5162185b8de8caa8bea639" - integrity sha512-F6a3l+ffCQ7hvvN16YG5bpm1rPZntCg66PLHDQ1apWJPOCUVHoKnL2w5fqEaTVhp42dmossTyXeR7hTGirfXrg== + version "10.1.2" + resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-10.1.2.tgz#11ffe03d813c653e768bdf762cfc5f1afe91b8bd" + integrity "sha1-Ef/gPYE8ZT52i992LPxfGv6RuL0= sha512-KsM/TdPmntqgBFlfsbkOLkkE9ovZo7VpVcd+/eTdYszCrgy5zFl5JzWm+OxavFaEWlbkirpkou+ZYI00RmOBFA==" dependencies: lru-cache "^6.0.0" make-fetch-happen "^8.0.9" @@ -8962,15 +8962,10 @@ write@1.0.3: dependencies: mkdirp "^0.5.1" -"ws@>= 2.2.3": - version "7.4.4" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.4.tgz#383bc9742cb202292c9077ceab6f6047b17f2d59" - integrity sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw== - -ws@^7.2.3: - version "7.4.2" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.2.tgz#782100048e54eb36fe9843363ab1c68672b261dd" - integrity sha512-T4tewALS3+qsrpGI/8dqNMLIVdq/g/85U98HPMa6F0m6xTbvhXU6RCQLqPH3+SlomNV/LdY6RXEbBpMH6EOJnA== +"ws@>= 2.2.3", ws@^7.2.3: + version "7.4.6" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" + integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== xdg-basedir@^4.0.0: version "4.0.0"