diff --git a/LANGUAGES.md b/LANGUAGES.md
index 8bf9a333d51..771a483883e 100644
--- a/LANGUAGES.md
+++ b/LANGUAGES.md
@@ -241,7 +241,7 @@ Thrift's core protocol is TBinary, supported by all languages except for JavaScr
0.6.0 |
 |  |
10.x | 10.x |
- |
+ |
 |  |  |  |  |  |
 |  |  |  |
 |  |  |  |
@@ -253,7 +253,7 @@ Thrift's core protocol is TBinary, supported by all languages except for JavaScr
0.12.0 |
 |  |
5.7.2 | |
- |
+ |
 |  |  |  |  |  |
 |  |  |  |
 |  |  |  |
diff --git a/build/docker/ubuntu-noble/Dockerfile b/build/docker/ubuntu-noble/Dockerfile
index a195fd460b5..3d17c905655 100644
--- a/build/docker/ubuntu-noble/Dockerfile
+++ b/build/docker/ubuntu-noble/Dockerfile
@@ -52,8 +52,8 @@ RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - &
/etc/apt/sources.list.d/dart_stable.list
# node.js
-RUN curl -sL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
- echo "deb https://deb.nodesource.com/node_16.x focal main" | tee /etc/apt/sources.list.d/nodesource.list
+RUN curl -sL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | apt-key add - && \
+ echo "deb https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
### install general dependencies
RUN apt-get update -yq && \
@@ -295,8 +295,8 @@ RUN apt-get install -y --no-install-recommends \
RUN apt-get install -y --no-install-recommends \
`# Static Code Analysis dependencies` \
cppcheck \
- sloccount
-
+ sloccount
+
#RUN pip install flake8
# NOTE: this does not reduce the image size but adds an additional layer.
diff --git a/compiler/cpp/src/thrift/generate/t_js_generator.cc b/compiler/cpp/src/thrift/generate/t_js_generator.cc
index 402ff50da58..107b8415aae 100644
--- a/compiler/cpp/src/thrift/generate/t_js_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_js_generator.cc
@@ -519,7 +519,7 @@ void t_js_generator::init_generator() {
string t_js_generator::js_includes() {
if (gen_node_) {
string result;
-
+
if (gen_esm_) {
result += "import { Thrift } from 'thrift';\n";
} else {
@@ -534,13 +534,16 @@ string t_js_generator::js_includes() {
}
}
if (gen_esm_) {
- result += "import Int64 from 'node-int64';";
+ result += "import Int64 from 'node-int64';\n";
+ result += "import { v4 as uuid } from 'uuid';";
} else {
result += js_const_type_ + "Int64 = require('node-int64');\n";
+ result += js_const_type_ + "uuid = require('uuid').v4;\n";
}
return result;
}
string result = "if (typeof Int64 === 'undefined' && typeof require === 'function') {\n " + js_const_type_ + "Int64 = require('node-int64');\n}\n";
+ result += "if (typeof uuid === 'undefined' && typeof require === 'function') {\n " + js_const_type_ + "uuid = require('uuid').v4;\n}\n";
return result;
}
@@ -553,9 +556,14 @@ string t_js_generator::ts_includes() {
"import thrift = require('thrift');\n"
"import Thrift = thrift.Thrift;\n"
"import Q = thrift.Q;\n"
- "import Int64 = require('node-int64');");
- }
- return string("import Int64 = require('node-int64');");
+ "import Int64 = require('node-int64');\n"
+ "import { v4 as uuid } from 'uuid';\n"
+ "type uuid = string;");
+ }
+ return string(
+ "import Int64 = require('node-int64');\n"
+ "import { v4 as uuid } from 'uuid';\n"
+ "type uuid = string;");
}
/**
@@ -742,6 +750,10 @@ string t_js_generator::render_const_value(t_type* type, t_const_value* value) {
case t_base_type::TYPE_STRING:
out << "'" << get_escaped_string(value) << "'";
break;
+ case t_base_type::TYPE_UUID:
+ // The UUID should be in the correct string format already the get_escaped* might be redundant
+ out << "'" << get_escaped_string(value) << "'";
+ break;
case t_base_type::TYPE_BOOL:
out << (value->get_integer() > 0 ? "true" : "false");
break;
@@ -2317,6 +2329,9 @@ void t_js_generator::generate_deserialize_field(ostream& out,
case t_base_type::TYPE_STRING:
out << (type->is_binary() ? "readBinary()" : "readString()");
break;
+ case t_base_type::TYPE_UUID:
+ out << "readUuid()";
+ break;
case t_base_type::TYPE_BOOL:
out << "readBool()";
break;
@@ -2503,6 +2518,9 @@ void t_js_generator::generate_serialize_field(ostream& out, t_field* tfield, str
case t_base_type::TYPE_STRING:
out << (type->is_binary() ? "writeBinary(" : "writeString(") << name << ")";
break;
+ case t_base_type::TYPE_UUID:
+ out << "writeUuid(" << name << ")";
+ break;
case t_base_type::TYPE_BOOL:
out << "writeBool(" << name << ")";
break;
@@ -2661,6 +2679,7 @@ string t_js_generator::declare_field(t_field* tfield, bool init, bool obj) {
case t_base_type::TYPE_VOID:
break;
case t_base_type::TYPE_STRING:
+ case t_base_type::TYPE_UUID:
case t_base_type::TYPE_BOOL:
case t_base_type::TYPE_I8:
case t_base_type::TYPE_I16:
@@ -2752,6 +2771,8 @@ string t_js_generator::type_to_enum(t_type* type) {
throw std::runtime_error("NO T_VOID CONSTRUCT");
case t_base_type::TYPE_STRING:
return "Thrift.Type.STRING";
+ case t_base_type::TYPE_UUID:
+ return "Thrift.Type.UUID";
case t_base_type::TYPE_BOOL:
return "Thrift.Type.BOOL";
case t_base_type::TYPE_I8:
@@ -2765,7 +2786,7 @@ string t_js_generator::type_to_enum(t_type* type) {
case t_base_type::TYPE_DOUBLE:
return "Thrift.Type.DOUBLE";
default:
- throw "compiler error: unhandled type";
+ throw "compiler error: unhandled js type";
}
} else if (type->is_enum()) {
return "Thrift.Type.I32";
@@ -2798,6 +2819,9 @@ string t_js_generator::ts_get_type(t_type* type) {
case t_base_type::TYPE_STRING:
ts_type = type->is_binary() ? "Buffer" : "string";
break;
+ case t_base_type::TYPE_UUID:
+ ts_type = "uuid";
+ break;
case t_base_type::TYPE_BOOL:
ts_type = "boolean";
break;
@@ -2816,7 +2840,7 @@ string t_js_generator::ts_get_type(t_type* type) {
ts_type = "void";
break;
default:
- throw "compiler error: unhandled type";
+ throw "compiler error: unhandled js type";
}
} else if (type->is_enum() || type->is_struct() || type->is_xception()) {
std::string type_name;
diff --git a/compiler/cpp/src/thrift/generate/t_st_generator.cc b/compiler/cpp/src/thrift/generate/t_st_generator.cc
index c1ad35577e8..68fe699108c 100644
--- a/compiler/cpp/src/thrift/generate/t_st_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_st_generator.cc
@@ -1037,7 +1037,7 @@ string t_st_generator::type_to_enum(t_type* type) {
case t_base_type::TYPE_DOUBLE:
return "TType double";
default:
- throw "compiler error: unhandled type";
+ throw "compiler error: unhandled ts type";
}
} else if (type->is_enum()) {
return "TType i32";
diff --git a/lib/nodejs/Makefile.am b/lib/nodejs/Makefile.am
index 0933701965d..ac192451ad2 100644
--- a/lib/nodejs/Makefile.am
+++ b/lib/nodejs/Makefile.am
@@ -17,11 +17,8 @@
# We call npm twice to work around npm issues
-stubs: $(top_srcdir)/test/v0.16/ThriftTest.thrift $(top_srcdir)/test/v0.16/FuzzTestNoUuid.thrift
- $(THRIFT) --gen js:node -o test/ $(top_srcdir)/test/v0.16/ThriftTest.thrift
- $(THRIFT) --gen js:node -o test/fuzz/ $(top_srcdir)/test/v0.16/FuzzTestNoUuid.thrift
- sed -i "s/require('thrift')/require(\"..\/..\/..\/lib\/thrift\")/" test/fuzz/gen-nodejs/FuzzTestNoUuid_types.js
-
+stubs: $(top_srcdir)/test/ThriftTest.thrift
+ $(THRIFT) --gen js:node -o test/ $(top_srcdir)/test/ThriftTest.thrift
deps-root: $(top_srcdir)/package.json
$(NPM) install $(top_srcdir)/ || $(NPM) install $(top_srcdir)/
diff --git a/lib/nodejs/lib/thrift/binary_protocol.js b/lib/nodejs/lib/thrift/binary_protocol.js
index fc4df4ae95e..d5b2e143709 100644
--- a/lib/nodejs/lib/thrift/binary_protocol.js
+++ b/lib/nodejs/lib/thrift/binary_protocol.js
@@ -23,6 +23,8 @@ var Int64 = require("node-int64");
var Thrift = require("./thrift");
var Type = Thrift.Type;
+const { parse: uuidParse, stringify: uuidStringify } = require("uuid");
+
module.exports = TBinaryProtocol;
// JavaScript supports only numeric doubles, therefore even hex values are always signed.
@@ -170,6 +172,10 @@ TBinaryProtocol.prototype.writeBinary = function (arg) {
this.writeStringOrBinary("writeBinary", "binary", arg);
};
+TBinaryProtocol.prototype.writeUuid = function (arg) {
+ this.trans.write(Buffer.from(uuidParse(arg)));
+};
+
TBinaryProtocol.prototype.readMessageBegin = function () {
var sz = this.readI32();
var type, name, seqid;
@@ -302,6 +308,11 @@ TBinaryProtocol.prototype.readString = function () {
return this.trans.readString(len);
};
+TBinaryProtocol.prototype.readUuid = function () {
+ const buf = this.trans.read(16);
+ return uuidStringify(new Uint8Array(buf));
+};
+
TBinaryProtocol.prototype.getTransport = function () {
return this.trans;
};
@@ -329,6 +340,9 @@ TBinaryProtocol.prototype.skip = function (type) {
case Type.STRING:
this.readString();
break;
+ case Type.UUID:
+ this.readUuid();
+ break;
case Type.STRUCT:
this.readStructBegin();
while (true) {
diff --git a/lib/nodejs/lib/thrift/compact_protocol.js b/lib/nodejs/lib/thrift/compact_protocol.js
index e946dc886c0..dd7851e7a79 100644
--- a/lib/nodejs/lib/thrift/compact_protocol.js
+++ b/lib/nodejs/lib/thrift/compact_protocol.js
@@ -22,6 +22,8 @@ var Int64 = require("node-int64");
var Thrift = require("./thrift");
var Type = Thrift.Type;
+const { parse: uuidParse, stringify: uuidStringify } = require("uuid");
+
module.exports = TCompactProtocol;
var POW_8 = Math.pow(2, 8);
@@ -120,6 +122,7 @@ TCompactProtocol.TYPE_SHIFT_AMOUNT = 5;
* @property {number} CT_SET - A collection type (unordered and without repeated values).
* @property {number} CT_MAP - A collection type (map/associative-array/dictionary).
* @property {number} CT_STRUCT - A multifield type.
+ * @property {number} CT_UUID - A UUID type.
*/
TCompactProtocol.Types = {
CT_STOP: 0x00,
@@ -135,6 +138,7 @@ TCompactProtocol.Types = {
CT_SET: 0x0a,
CT_MAP: 0x0b,
CT_STRUCT: 0x0c,
+ CT_UUID: 0x0d,
};
/**
@@ -158,6 +162,7 @@ TCompactProtocol.TTypeToCType = [
TCompactProtocol.Types.CT_MAP, // T_MAP
TCompactProtocol.Types.CT_SET, // T_SET
TCompactProtocol.Types.CT_LIST, // T_LIST
+ TCompactProtocol.Types.CT_UUID, // T_UUID
];
//
@@ -214,6 +219,8 @@ TCompactProtocol.prototype.getTType = function (type) {
return Type.MAP;
case TCompactProtocol.Types.CT_STRUCT:
return Type.STRUCT;
+ case TCompactProtocol.Types.CT_UUID:
+ return Type.UUID;
default:
throw new Thrift.TProtocolException(
Thrift.TProtocolExceptionType.INVALID_DATA,
@@ -459,6 +466,10 @@ TCompactProtocol.prototype.writeBinary = function (arg) {
this.writeStringOrBinary("writeBinary", "binary", arg);
};
+TCompactProtocol.prototype.writeUuid = function (arg) {
+ this.trans.write(Buffer.from(uuidParse(arg)));
+};
+
//
// Compact Protocol internal write methods
//
@@ -735,6 +746,11 @@ TCompactProtocol.prototype.readByte = function () {
return this.trans.readByte();
};
+TCompactProtocol.prototype.readUuid = function () {
+ const buf = this.trans.read(16);
+ return uuidStringify(new Uint8Array(buf));
+};
+
TCompactProtocol.prototype.readI16 = function () {
return this.readI32();
};
@@ -908,6 +924,9 @@ TCompactProtocol.prototype.skip = function (type) {
case Type.STRING:
this.readString();
break;
+ case Type.UUID:
+ this.readUuid();
+ break;
case Type.STRUCT:
this.readStructBegin();
while (true) {
diff --git a/lib/nodejs/lib/thrift/header_protocol.js b/lib/nodejs/lib/thrift/header_protocol.js
index 2a48a4d7d2a..7452925650f 100644
--- a/lib/nodejs/lib/thrift/header_protocol.js
+++ b/lib/nodejs/lib/thrift/header_protocol.js
@@ -158,6 +158,10 @@ THeaderProtocol.prototype.writeBinary = function (arg) {
return this.protocol.writeBinary(arg);
};
+THeaderProtocol.prototype.writeUuid = function (arg) {
+ return this.protocol.writeUuid(arg);
+};
+
THeaderProtocol.prototype.readMessageBegin = function () {
this.trans.readHeaders();
this.setProtocol();
@@ -236,6 +240,10 @@ THeaderProtocol.prototype.readBinary = function () {
return this.protocol.readBinary();
};
+THeaderProtocol.prototype.readUuid = function () {
+ return this.protocol.readUuid();
+};
+
THeaderProtocol.prototype.readString = function () {
return this.protocol.readString();
};
diff --git a/lib/nodejs/lib/thrift/json_protocol.js b/lib/nodejs/lib/thrift/json_protocol.js
index 31dcb8196a7..176da38c601 100644
--- a/lib/nodejs/lib/thrift/json_protocol.js
+++ b/lib/nodejs/lib/thrift/json_protocol.js
@@ -62,6 +62,7 @@ TJSONProtocol.Type[Type.STRING] = '"str"';
TJSONProtocol.Type[Type.MAP] = '"map"';
TJSONProtocol.Type[Type.LIST] = '"lst"';
TJSONProtocol.Type[Type.SET] = '"set"';
+TJSONProtocol.Type[Type.UUID] = '"uid"';
/**
* Thrift IDL type string to Id mapping.
@@ -80,6 +81,7 @@ TJSONProtocol.RType.str = Type.STRING;
TJSONProtocol.RType.map = Type.MAP;
TJSONProtocol.RType.lst = Type.LIST;
TJSONProtocol.RType.set = Type.SET;
+TJSONProtocol.RType.uid = Type.UUID;
/**
* The TJSONProtocol version number.
@@ -424,6 +426,11 @@ TJSONProtocol.prototype.writeBinary = function (arg) {
this.tstack.push('"' + buf.toString("base64") + '"');
};
+/** Serializes a UUID */
+TJSONProtocol.prototype.writeUuid = function (arg) {
+ this.tstack.push('"' + arg + '"');
+};
+
/**
* @class
* @name AnonReadMessageBeginReturn
@@ -758,6 +765,10 @@ TJSONProtocol.prototype.readString = function () {
return this.readValue();
};
+TJSONProtocol.prototype.readUuid = function() {
+ return this.readValue();
+};
+
/**
* Returns the underlying transport.
* @readonly
@@ -793,6 +804,9 @@ TJSONProtocol.prototype.skip = function (type) {
case Type.STRING:
this.readString();
break;
+ case Type.UUID:
+ this.readUuid();
+ break;
case Type.STRUCT:
this.readStructBegin();
while (true) {
diff --git a/lib/nodejs/lib/thrift/thrift.js b/lib/nodejs/lib/thrift/thrift.js
index 741a493835d..ff6897d8b06 100644
--- a/lib/nodejs/lib/thrift/thrift.js
+++ b/lib/nodejs/lib/thrift/thrift.js
@@ -34,8 +34,7 @@ var Type = (exports.Type = {
MAP: 13,
SET: 14,
LIST: 15,
- UTF8: 16,
- UTF16: 17,
+ UUID: 16,
});
exports.MessageType = {
diff --git a/lib/nodejs/test/certificates.README b/lib/nodejs/test/certificates.README
deleted file mode 100644
index 06c507e7d75..00000000000
--- a/lib/nodejs/test/certificates.README
+++ /dev/null
@@ -1,7 +0,0 @@
-server.crt AND server.key ARE PROVIDED FOR TEST PURPOSE AND SHOULD *NEVER* BE USED IN PRODUCTION
-
-
-Origin of the test key and cert is the folder test/keys of Apache Thrift source code distribution
-
-We need copies for npm deployment
-
diff --git a/lib/nodejs/test/package-lock.json b/lib/nodejs/test/package-lock.json
index 6faee9d05b2..bcd8e4437f9 100644
--- a/lib/nodejs/test/package-lock.json
+++ b/lib/nodejs/test/package-lock.json
@@ -9,6 +9,7 @@
}
},
"../../..": {
+ "name": "thrift",
"version": "0.23.0",
"dev": true,
"license": "Apache-2.0",
@@ -17,6 +18,7 @@
"isomorphic-ws": "^4.0.1",
"node-int64": "^0.4.0",
"q": "^1.5.0",
+ "uuid": "^13.0.0",
"ws": "^5.2.3"
},
"devDependencies": {
diff --git a/lib/nodejs/test/server.crt b/lib/nodejs/test/server.crt
deleted file mode 100644
index 8a5ef3c3a9d..00000000000
--- a/lib/nodejs/test/server.crt
+++ /dev/null
@@ -1,25 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIENzCCAx+gAwIBAgIJAOYfYfw7NCOcMA0GCSqGSIb3DQEBBQUAMIGxMQswCQYD
-VQQGEwJVUzERMA8GA1UECAwITWFyeWxhbmQxFDASBgNVBAcMC0ZvcmVzdCBIaWxs
-MScwJQYDVQQKDB5UaGUgQXBhY2hlIFNvZnR3YXJlIEZvdW5kYXRpb24xFjAUBgNV
-BAsMDUFwYWNoZSBUaHJpZnQxEjAQBgNVBAMMCWxvY2FsaG9zdDEkMCIGCSqGSIb3
-DQEJARYVZGV2QHRocmlmdC5hcGFjaGUub3JnMB4XDTE0MDQwNzE4NTgwMFoXDTIy
-MDYyNDE4NTgwMFowgbExCzAJBgNVBAYTAlVTMREwDwYDVQQIDAhNYXJ5bGFuZDEU
-MBIGA1UEBwwLRm9yZXN0IEhpbGwxJzAlBgNVBAoMHlRoZSBBcGFjaGUgU29mdHdh
-cmUgRm91bmRhdGlvbjEWMBQGA1UECwwNQXBhY2hlIFRocmlmdDESMBAGA1UEAwwJ
-bG9jYWxob3N0MSQwIgYJKoZIhvcNAQkBFhVkZXZAdGhyaWZ0LmFwYWNoZS5vcmcw
-ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCqE9TE9wEXp5LRtLQVDSGQ
-GV78+7ZtP/I/ZaJ6Q6ZGlfxDFvZjFF73seNhAvlKlYm/jflIHYLnNOCySN8I2Xw6
-L9MbC+jvwkEKfQo4eDoxZnOZjNF5J1/lZtBeOowMkhhzBMH1Rds351/HjKNg6ZKg
-2Cldd0j7HbDtEixOLgLbPRpBcaYrLrNMasf3Hal+x8/b8ue28x93HSQBGmZmMIUw
-AinEu/fNP4lLGl/0kZb76TnyRpYSPYojtS6CnkH+QLYnsRREXJYwD1Xku62LipkX
-wCkRTnZ5nUsDMX6FPKgjQFQCWDXG/N096+PRUQAChhrXsJ+gF3NqWtDmtrhVQF4n
-AgMBAAGjUDBOMB0GA1UdDgQWBBQo8v0wzQPx3EEexJPGlxPK1PpgKjAfBgNVHSME
-GDAWgBQo8v0wzQPx3EEexJPGlxPK1PpgKjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3
-DQEBBQUAA4IBAQBGFRiJslcX0aJkwZpzTwSUdgcfKbpvNEbCNtVohfQVTI4a/oN5
-U+yqDZJg3vOaOuiAZqyHcIlZ8qyesCgRN314Tl4/JQ++CW8mKj1meTgo5YFxcZYm
-T9vsI3C+Nzn84DINgI9mx6yktIt3QOKZRDpzyPkUzxsyJ8J427DaimDrjTR+fTwD
-1Dh09xeeMnSa5zeV1HEDyJTqCXutLetwQ/IyfmMBhIx+nvB5f67pz/m+Dv6V0r3I
-p4HCcdnDUDGJbfqtoqsAATQQWO+WWuswB6mOhDbvPTxhRpZq6AkgWqv4S+u3M2GO
-r5p9FrBgavAw5bKO54C0oQKpN/5fta5l6Ws0
------END CERTIFICATE-----
diff --git a/lib/nodejs/test/server.key b/lib/nodejs/test/server.key
deleted file mode 100644
index 263cfce59a1..00000000000
--- a/lib/nodejs/test/server.key
+++ /dev/null
@@ -1,28 +0,0 @@
------BEGIN PRIVATE KEY-----
-MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCqE9TE9wEXp5LR
-tLQVDSGQGV78+7ZtP/I/ZaJ6Q6ZGlfxDFvZjFF73seNhAvlKlYm/jflIHYLnNOCy
-SN8I2Xw6L9MbC+jvwkEKfQo4eDoxZnOZjNF5J1/lZtBeOowMkhhzBMH1Rds351/H
-jKNg6ZKg2Cldd0j7HbDtEixOLgLbPRpBcaYrLrNMasf3Hal+x8/b8ue28x93HSQB
-GmZmMIUwAinEu/fNP4lLGl/0kZb76TnyRpYSPYojtS6CnkH+QLYnsRREXJYwD1Xk
-u62LipkXwCkRTnZ5nUsDMX6FPKgjQFQCWDXG/N096+PRUQAChhrXsJ+gF3NqWtDm
-trhVQF4nAgMBAAECggEAW/y52YYW6ypROGbZ94DQpFV0kLO7qT8q0Ksxw5sPNaIt
-fEPRIymDa8ikyHWJS5Oxmw84wo5jnJV26jaLmwe2Lupq7Xf1lqej8f5LJtuv7cQR
-xfzp1vM65KJFFJHp6WqjGqJ6HSSZOpVDsnQYcXQjQCdpyAmaSWd3p+FqYSZ1mQmD
-bFNI7jqpczWSZhTdotQ7p7Hn9TVCehflP3yGIB3bQ+wCcCB85dOBz201L+YgaIck
-Sz43A4NvWaQIRLRDw7s9GW4jY5T0Jv282WIeAlVpVxLIwu48r4R4yGTIx9Ydowvq
-57+Y5iPPjAXxu0V9t00oS3bYxDaKh2DUfc/5zowq8QKBgQDYNVPXmaG0aIH4vjQ9
-7fRdw/UDkYcQbn6CnglQOu77/S8ogQzpKCVJgJgkZNqOVtQMEPzekGEcLTbje1gU
-8Bky2k+PL9UwbFy0emnOVh4rqrNXHsRvJcehNT/PRb5hjF3MUMFV/0iD4b+naFaE
-jrSWiZ2ZXj2qfwAK52GFbtOuBQKBgQDJYQuGiY0r22E4waJmCSKczoBT3cwlVzWj
-V2ljgA9RHLNTVkvNNYQLGu2qngFrtwpeaSnsMDerVG4wKAQWyCnYzxVrlnC4uDrJ
-HXuFEltBWi9Ffbgfsnd3749AT0oBP1NT2tMleguyf5DFgjCR3VRJLdrVaaZ8row/
-LqKcFMqnOwKBgB+OIO99l7E584Y3VG6ZdSneOLtNmRXX2pT7tcZE465ZdHGH7Dd3
-SYHhx9K/+Xn+yDH+pLli/xlarAEldmSP6k2WuTfftlC78AfTOfAId5zN7CDR9791
-Fx67I9X/itq33tS8EIuZl57P6uXm/4GXRloWOa8xpvRkVsBApuYPl8t1AoGATQDS
-y2sllDObBXzlgGbV2WgNIgSZ311toTv3jJiXQsjauW8yJRHln+l4H9mzaWDgkiFc
-ang1kUoDqF5k0eFQPxtQcYdhKwEnWWfwp33RbzfxA32DPnubuzzbZhfrkHaKgnIW
-cyor9uFYlm2l7ODZLfJez2RKyTplXnOSsmQw6akCgYAz3dj9Hskyj+HVJ+ht1OcE
-c7ai/ESkSA7Vajp0tjJp0EKjW/zq8DvUSXOtcdnJgkKycFluLwbmnaN4txBds1C1
-Qr8Rt2sUCCBNZe1L6DHe3XBdbkJe9sgZVNTjtUSQrzy8UhvsCqG4YWeCu07Szcbc
-rdPUV9/uQkdx8VrShxlD8A==
------END PRIVATE KEY-----
diff --git a/lib/nodejs/test/server.mjs b/lib/nodejs/test/server.mjs
index 7a3c593c07f..4b198a1e1da 100644
--- a/lib/nodejs/test/server.mjs
+++ b/lib/nodejs/test/server.mjs
@@ -119,8 +119,12 @@ if (ssl) {
type === "websocket"
) {
options.tls = {
- key: fs.readFileSync(path.resolve(import.meta.dirname, "server.key")),
- cert: fs.readFileSync(path.resolve(import.meta.dirname, "server.crt")),
+ key: fs.readFileSync(
+ path.resolve(import.meta.dirname, "../../../test/keys/server.key"),
+ ),
+ cert: fs.readFileSync(
+ path.resolve(import.meta.dirname, "../../../test/keys/server.crt"),
+ ),
};
}
}
diff --git a/lib/nodejs/test/test-cases.mjs b/lib/nodejs/test/test-cases.mjs
index 543e3539ce1..c074923ba43 100644
--- a/lib/nodejs/test/test-cases.mjs
+++ b/lib/nodejs/test/test-cases.mjs
@@ -21,6 +21,7 @@
import helpers from "./helpers.js";
import Int64 from "node-int64";
+import { v4 as uuidv4, v7 as uuidv7 } from "uuid";
const ttypes = await helpers.importTypes(`ThriftTest_types`);
@@ -97,6 +98,9 @@ export const simple = [
new Int64(new Buffer([0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff])),
], // -2^53-1
["testTypedef", 69],
+ ["testUuid", "00112233-4455-6677-8899-aabbccddeeff"],
+ ["testUuid", uuidv4()],
+ ["testUuid", uuidv7()],
];
const mapout = {};
diff --git a/lib/nodejs/test/testAll.sh b/lib/nodejs/test/testAll.sh
index a3baa6e438b..1823a8cc2c5 100755
--- a/lib/nodejs/test/testAll.sh
+++ b/lib/nodejs/test/testAll.sh
@@ -85,17 +85,17 @@ TESTOK=0
# generating Thrift code
-${THRIFT_COMPILER} -o ${DIR} --gen js:node ${THRIFT_FILES_DIR}/v0.16/ThriftTest.thrift
+${THRIFT_COMPILER} -o ${DIR} --gen js:node ${THRIFT_FILES_DIR}/ThriftTest.thrift
${THRIFT_COMPILER} -o ${DIR} --gen js:node ${THRIFT_FILES_DIR}/JsDeepConstructorTest.thrift
${THRIFT_COMPILER} -o ${DIR} --gen js:node ${THRIFT_FILES_DIR}/Int64Test.thrift
${THRIFT_COMPILER} -o ${DIR} --gen js:node ${THRIFT_FILES_DIR}/Include.thrift
mkdir ${DIR}/gen-nodejs-es6
-${THRIFT_COMPILER} -out ${DIR}/gen-nodejs-es6 --gen js:node,es6 ${THRIFT_FILES_DIR}/v0.16/ThriftTest.thrift
+${THRIFT_COMPILER} -out ${DIR}/gen-nodejs-es6 --gen js:node,es6 ${THRIFT_FILES_DIR}/ThriftTest.thrift
${THRIFT_COMPILER} -out ${DIR}/gen-nodejs-es6 --gen js:node,es6 ${THRIFT_FILES_DIR}/JsDeepConstructorTest.thrift
${THRIFT_COMPILER} -out ${DIR}/gen-nodejs-es6 --gen js:node,es6 ${THRIFT_FILES_DIR}/Int64Test.thrift
${THRIFT_COMPILER} -out ${DIR}/gen-nodejs-es6 --gen js:node,es6 ${THRIFT_FILES_DIR}/Include.thrift
mkdir ${DIR}/gen-nodejs-esm
-${THRIFT_COMPILER} -out ${DIR}/gen-nodejs-esm --gen js:node,es6,esm ${THRIFT_FILES_DIR}/v0.16/ThriftTest.thrift
+${THRIFT_COMPILER} -out ${DIR}/gen-nodejs-esm --gen js:node,es6,esm ${THRIFT_FILES_DIR}/ThriftTest.thrift
${THRIFT_COMPILER} -out ${DIR}/gen-nodejs-esm --gen js:node,es6,esm ${THRIFT_FILES_DIR}/JsDeepConstructorTest.thrift
${THRIFT_COMPILER} -out ${DIR}/gen-nodejs-esm --gen js:node,es6,esm ${THRIFT_FILES_DIR}/Int64Test.thrift
${THRIFT_COMPILER} -out ${DIR}/gen-nodejs-esm --gen js:node,es6,esm ${THRIFT_FILES_DIR}/Include.thrift
diff --git a/lib/nodejs/test/test_handler.mjs b/lib/nodejs/test/test_handler.mjs
index a378fe16e72..e6a2af26cd5 100644
--- a/lib/nodejs/test/test_handler.mjs
+++ b/lib/nodejs/test/test_handler.mjs
@@ -64,6 +64,7 @@ const identityHandlers = [
"testI64",
"testDouble",
"testBinary",
+ "testUuid",
"testStruct",
"testNest",
"testMap",
diff --git a/lib/nodets/Makefile.am b/lib/nodets/Makefile.am
index ac2aa6e1b17..de523f5f42f 100644
--- a/lib/nodets/Makefile.am
+++ b/lib/nodets/Makefile.am
@@ -17,9 +17,9 @@
# We call npm twice to work around npm issues
-stubs: $(top_srcdir)/test/v0.16/ThriftTest.thrift
+stubs: $(top_srcdir)/test/ThriftTest.thrift
mkdir -p test-compiled
- $(THRIFT) --gen js:node,ts -o test/ $(top_srcdir)/test/v0.16/ThriftTest.thrift && $(THRIFT) --gen js:node,ts -o test-compiled $(top_srcdir)/test/v0.16/ThriftTest.thrift
+ $(THRIFT) --gen js:node,ts -o test/ $(top_srcdir)/test/ThriftTest.thrift && $(THRIFT) --gen js:node,ts -o test-compiled $(top_srcdir)/test/ThriftTest.thrift
$(THRIFT) --gen js:node,ts -o test/ $(top_srcdir)/test/Int64Test.thrift && $(THRIFT) --gen js:node,ts -o test-compiled $(top_srcdir)/test/Int64Test.thrift
ts-compile: stubs
diff --git a/lib/nodets/test/client.ts b/lib/nodets/test/client.ts
index c2666bc0d86..99b59607622 100644
--- a/lib/nodets/test/client.ts
+++ b/lib/nodets/test/client.ts
@@ -28,9 +28,10 @@ import ThriftTestDriverPromise = test_driver.ThriftTestDriverPromise;
import { program } from "commander";
program
- .option("--port ", "Set thrift server port number to connect", Number.parseInt, 9090)
+ .option("--port ", "Set thrift server port number to connect", (v) => parseInt(v, 10), 9090)
.option("--promise", "test with promise style functions")
- .option("--protocol", "Set thrift protocol (binary) [protocol]")
+ .option('--protocol ', '"Set thrift protocol (binary) [protocol]"')
+ .option('--transport ', '"Set thrift transport (buffered) [transport]"')
.parse(process.argv);
diff --git a/lib/nodets/test/runClient.sh b/lib/nodets/test/runClient.sh
index 9497da38872..8d5e9a33f00 100755
--- a/lib/nodets/test/runClient.sh
+++ b/lib/nodets/test/runClient.sh
@@ -10,8 +10,8 @@ export NODE_PATH="${DIR}:${DIR}/../../nodejs/lib:${NODE_PATH}"
compile()
{
#generating thrift code
- ${DIR}/../../../compiler/cpp/thrift -o ${DIR} --gen js:node,ts ${DIR}/../../../test/v0.16/ThriftTest.thrift
- ${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/v0.16/ThriftTest.thrift
+ ${DIR}/../../../compiler/cpp/thrift -o ${DIR} --gen js:node,ts ${DIR}/../../../test/ThriftTest.thrift
+ ${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/ThriftTest.thrift
}
compile
diff --git a/lib/nodets/test/runServer.sh b/lib/nodets/test/runServer.sh
index ec26513d153..4eee92717ec 100755
--- a/lib/nodets/test/runServer.sh
+++ b/lib/nodets/test/runServer.sh
@@ -10,8 +10,8 @@ export NODE_PATH="${DIR}:${DIR}/../../nodejs/lib:${NODE_PATH}"
compile()
{
#generating thrift code
- ${DIR}/../../../compiler/cpp/thrift -o ${DIR} --gen js:node,ts ${DIR}/../../../test/v0.16/ThriftTest.thrift
- ${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/v0.16/ThriftTest.thrift
+ ${DIR}/../../../compiler/cpp/thrift -o ${DIR} --gen js:node,ts ${DIR}/../../../test/ThriftTest.thrift
+ ${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/ThriftTest.thrift
}
compile
diff --git a/lib/nodets/test/server.ts b/lib/nodets/test/server.ts
index 59113840a41..a2ef5c698ca 100644
--- a/lib/nodets/test/server.ts
+++ b/lib/nodets/test/server.ts
@@ -5,9 +5,10 @@ import test_handler = require('./test_handler');
program
- .option('--port ', 'Set thrift server port', Number.parseInt, 9090)
+ .option('--port ', 'Set thrift server port', (v) => parseInt(v, 10), 9090)
.option('--promise', 'test with promise style functions')
- .option('--protocol', '"Set thrift protocol (binary) [protocol]"')
+ .option('--protocol ', '"Set thrift protocol (binary) [protocol]"')
+ .option('--transport ', '"Set thrift transport (buffered) [transport]"')
.parse(process.argv);
var opts = program.opts();
diff --git a/lib/nodets/test/test-cases.ts b/lib/nodets/test/test-cases.ts
index 98f54af5ca5..c836550bd32 100644
--- a/lib/nodets/test/test-cases.ts
+++ b/lib/nodets/test/test-cases.ts
@@ -2,6 +2,7 @@
import ttypes = require("./gen-nodejs/ThriftTest_types");
import Int64 = require("node-int64");
+import { v4 as uuidv4, v7 as uuidv7 } from 'uuid';
//all Languages in UTF-8
/*jshint -W100 */
@@ -64,6 +65,9 @@ export var simple = [
["testDouble", -5.2098523],
["testDouble", 7.012052175215044],
["testEnum", ttypes.Numberz.ONE],
+ ["testUuid", "00112233-4455-6677-8899-aabbccddeeff"],
+ ["testUuid", uuidv4()],
+ ["testUuid", uuidv7()],
];
export var simpleLoose = [
diff --git a/lib/nodets/test/testAll.sh b/lib/nodets/test/testAll.sh
index 8180e2a1a3c..3be12c3622a 100755
--- a/lib/nodets/test/testAll.sh
+++ b/lib/nodets/test/testAll.sh
@@ -10,9 +10,9 @@ export NODE_PATH="${DIR}:${DIR}/../../nodejs/lib:${NODE_PATH}"
compile()
{
#generating thrift code
- ${DIR}/../../../compiler/cpp/thrift -o ${DIR} --gen js:node,ts ${DIR}/../../../test/v0.16/ThriftTest.thrift
+ ${DIR}/../../../compiler/cpp/thrift -o ${DIR} --gen js:node,ts ${DIR}/../../../test/ThriftTest.thrift
${DIR}/../../../compiler/cpp/thrift -o ${DIR} --gen js:node,ts ${DIR}/../../../test/Int64Test.thrift
- ${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/v0.16/ThriftTest.thrift
+ ${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/ThriftTest.thrift
${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/Int64Test.thrift
tsc --outDir $COMPILEDDIR --project $DIR/tsconfig.json
diff --git a/lib/nodets/test/test_handler.ts b/lib/nodets/test/test_handler.ts
index 823b4e7ee03..9e74a6b11d5 100644
--- a/lib/nodets/test/test_handler.ts
+++ b/lib/nodets/test/test_handler.ts
@@ -25,6 +25,8 @@ import thrift = require("thrift");
import Thrift = thrift.Thrift;
import Q = require("q");
import Int64 = require("node-int64");
+import { v4 as uuid } from "uuid";
+type uuid = string;
export class SyncThriftTestHandler {
testVoid(): Q.IPromise {
@@ -130,6 +132,9 @@ export class SyncThriftTestHandler {
testBinary(thing: Buffer) {
return Q.resolve(thing);
}
+ testUuid(thing: uuid) {
+ return Q.resolve(thing);
+ }
testStruct(thing: ttypes.Xtruct) {
return Q.resolve(thing);
}
@@ -309,6 +314,13 @@ export class AsyncThriftTestHandler {
callback(null, thing);
return Q.resolve();
}
+ testUuid(
+ thing: uuid,
+ callback: (err: any, result: uuid) => void,
+ ): Q.IPromise {
+ callback(null, thing);
+ return Q.resolve();
+ }
testStruct(
thing: ttypes.Xtruct,
callback: (err: any, result: ttypes.Xtruct) => void,
diff --git a/package-lock.json b/package-lock.json
index b1c25cf64d0..fa1e607fcbb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -13,6 +13,7 @@
"isomorphic-ws": "^4.0.1",
"node-int64": "^0.4.0",
"q": "^1.5.0",
+ "uuid": "^13.0.0",
"ws": "^5.2.3"
},
"devDependencies": {
@@ -2475,6 +2476,17 @@
"url": "https://github.com/sponsors/isaacs"
}
},
+ "node_modules/istanbul-lib-processinfo/node_modules/uuid": {
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
+ "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
+ "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "uuid": "bin/uuid"
+ }
+ },
"node_modules/istanbul-lib-report": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz",
@@ -3049,6 +3061,17 @@
"url": "https://github.com/sponsors/isaacs"
}
},
+ "node_modules/nyc/node_modules/uuid": {
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
+ "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
+ "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "uuid": "bin/uuid"
+ }
+ },
"node_modules/oauth-sign": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
@@ -3371,6 +3394,17 @@
"node": ">= 6"
}
},
+ "node_modules/request/node_modules/uuid": {
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
+ "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
+ "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "uuid": "bin/uuid"
+ }
+ },
"node_modules/require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
@@ -3826,13 +3860,16 @@
}
},
"node_modules/uuid": {
- "version": "3.4.0",
- "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
- "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
- "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
- "dev": true,
+ "version": "13.0.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-13.0.0.tgz",
+ "integrity": "sha512-XQegIaBTVUjSHliKqcnFqYypAd4S+WCYt5NIeRs6w/UAry7z8Y9j5ZwRRL4kzq9U3sD6v+85er9FvkEaBpji2w==",
+ "funding": [
+ "https://github.com/sponsors/broofa",
+ "https://github.com/sponsors/ctavan"
+ ],
+ "license": "MIT",
"bin": {
- "uuid": "bin/uuid"
+ "uuid": "dist-node/bin/uuid"
}
},
"node_modules/valid-url": {
diff --git a/package.json b/package.json
index 59bc8207957..478618f55be 100644
--- a/package.json
+++ b/package.json
@@ -40,6 +40,7 @@
"isomorphic-ws": "^4.0.1",
"node-int64": "^0.4.0",
"q": "^1.5.0",
+ "uuid": "^13.0.0",
"ws": "^5.2.3"
},
"devDependencies": {
diff --git a/test/known_failures_Linux.json b/test/known_failures_Linux.json
index 6afe00c4cbe..f01e5aa6b1a 100644
--- a/test/known_failures_Linux.json
+++ b/test/known_failures_Linux.json
@@ -692,28 +692,15 @@
"nodejs-cpp_binary_http-domain",
"nodejs-cpp_binary_http-ip",
"nodejs-cpp_binary_http-ip-ssl",
- "nodejs-cpp_binary_websocket-domain",
- "nodejs-cpp_binary_websocket-ip",
- "nodejs-cpp_binary_websocket-ip-ssl",
"nodejs-cpp_compact_http-domain",
"nodejs-cpp_compact_http-ip",
"nodejs-cpp_compact_http-ip-ssl",
- "nodejs-cpp_compact_websocket-domain",
- "nodejs-cpp_compact_websocket-ip",
- "nodejs-cpp_compact_websocket-ip-ssl",
"nodejs-cpp_header_http-domain",
"nodejs-cpp_header_http-ip",
"nodejs-cpp_header_http-ip-ssl",
- "nodejs-cpp_header_websocket-domain",
- "nodejs-cpp_header_websocket-ip",
- "nodejs-cpp_header_websocket-ip-ssl",
- "nodejs-cpp_json_buffered-ip-ssl",
"nodejs-cpp_json_http-domain",
"nodejs-cpp_json_http-ip",
"nodejs-cpp_json_http-ip-ssl",
- "nodejs-cpp_json_websocket-domain",
- "nodejs-cpp_json_websocket-ip",
- "nodejs-cpp_json_websocket-ip-ssl",
"nodejs-d_binary_http-ip",
"nodejs-d_binary_http-ip-ssl",
"nodejs-d_compact_http-ip",
diff --git a/test/tests.json b/test/tests.json
index bcc87d3217b..ff795648b49 100644
--- a/test/tests.json
+++ b/test/tests.json
@@ -219,7 +219,7 @@
"server": {
"command": [
"node",
- "server.js",
+ "server.mjs",
"--type=tcp"
]
},
@@ -227,7 +227,7 @@
"timeout": 6,
"command": [
"node",
- "client.js",
+ "client.mjs",
"--type=tcp"
]
},