diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea4416e..a2a7dd8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,14 +22,16 @@ jobs: node_version: - 18 - 20 + - 22 + - 24 opendds_branch: - master - latest-release m: - {os: ubuntu-22.04, dds_security: 1} - {os: ubuntu-22.04, dds_security: 0} - - {os: macos-13, dds_security: 1} - - {os: macos-13, dds_security: 0} + - {os: macos-14, dds_security: 1} + - {os: macos-14, dds_security: 0} - {os: windows-2022, dds_security: 1} - {os: windows-2022, dds_security: 0} @@ -60,13 +62,30 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node_version }} + cache: 'npm' + - name: 'Get Repository SHAs' + id: get-shas + shell: bash + run: | + echo "opendds_sha=$(cd OpenDDS && git rev-parse HEAD)" >> $GITHUB_OUTPUT + echo "acetao_sha=$(cd ACE_TAO && git rev-parse HEAD)" >> $GITHUB_OUTPUT + echo "mpc_sha=$(cd MPC && git rev-parse HEAD)" >> $GITHUB_OUTPUT + - name: 'Cache OpenDDS Build' + uses: actions/cache@v4 + id: cache-opendds + with: + path: | + ACE_TAO + OpenDDS + MPC + key: opendds-build-${{ matrix.m.os }}-${{ matrix.opendds_branch }}-sec${{ matrix.m.dds_security }}-${{ steps.get-shas.outputs.opendds_sha }}-${{ steps.get-shas.outputs.acetao_sha }} - name: 'Install xerces (ubuntu)' if: ${{ matrix.m.dds_security == 1 && matrix.m.os == 'ubuntu-22.04' }} run: |- sudo apt-get update sudo apt-get -y install libxerces-c-dev - name: 'Install xerces (macos)' - if: ${{ matrix.m.dds_security == 1 && matrix.m.os == 'macos-13' }} + if: ${{ matrix.m.dds_security == 1 && matrix.m.os == 'macos-14' }} run: | brew install xerces-c - name: Setup for run-vcpkg @@ -81,7 +100,7 @@ jobs: uses: lukka/run-vcpkg@v11 with: vcpkgDirectory: '${{ github.workspace }}/vcpkg' - vcpkgGitCommitId: 898b728edc5e0d12b50015f9cd18247c4257a3eb + vcpkgGitCommitId: 940f58770cee8e2011bfb4847fb2bd70057301a8 runVcpkgInstall: true - name: 'Set Up MSVC Environment' if: ${{ matrix.m.os == 'windows-2022' }} @@ -90,10 +109,10 @@ jobs: if: ${{ matrix.m.os == 'windows-2022' }} uses: ammaraskar/msvc-problem-matcher@0.3.0 - name: 'Set Up Problem Matcher (ubuntu / macos)' - if: ${{ matrix.m.os == 'ubuntu-22.04' || matrix.m.os == 'macos-13' }} + if: ${{ matrix.m.os == 'ubuntu-22.04' || matrix.m.os == 'macos-14' }} uses: ammaraskar/gcc-problem-matcher@0.3.0 - name: 'Set environment variables (ubuntu / macos)' - if: ${{ matrix.m.os == 'ubuntu-22.04' || matrix.m.os == 'macos-13' }} + if: ${{ matrix.m.os == 'ubuntu-22.04' || matrix.m.os == 'macos-14' }} shell: bash run: |- echo "ACE_ROOT=$GITHUB_WORKSPACE/ACE_TAO/ACE" >> $GITHUB_ENV @@ -106,8 +125,8 @@ jobs: if [ ${{ matrix.m.dds_security }} == 1 ]; then CONFIG_OPTIONS+=" --security" BUILD_TARGETS+=" OpenDDS_Security" - if [ '${{ matrix.m.os }}' == 'macos-13' ]; then - CONFIG_OPTIONS+=" --xerces3=$(brew --prefix xerces-c) --openssl=/usr/local/opt/openssl@1.1" + if [ '${{ matrix.m.os }}' == 'macos-14' ]; then + CONFIG_OPTIONS+=" --xerces3=$(brew --prefix xerces-c) --openssl=$(brew --prefix openssl@3)" fi fi echo "CONFIG_OPTIONS=$CONFIG_OPTIONS" >> $GITHUB_ENV @@ -130,7 +149,7 @@ jobs: echo "BUILD_TARGETS=DCPSInfoRepo_Main;OpenDDS_Rtps_Udp$BUILD_TARGETS" >> $GITHUB_ENV echo "ACE_TEST_LOG_STUCK_STACKS=1" >> $GITHUB_ENV - name: 'Configure & Build OpenDDS (ubuntu / macos)' - if: ${{ matrix.m.os == 'ubuntu-22.04' || matrix.m.os == 'macos-13' }} + if: ${{ (matrix.m.os == 'ubuntu-22.04' || matrix.m.os == 'macos-14') && steps.cache-opendds.outputs.cache-hit != 'true' }} shell: bash run: |- echo "dds_security=${{ matrix.m.dds_security }}; CONFIG_OPTIONS=${{ env.CONFIG_OPTIONS }}; BUILD_TARGETS=${{ env.BUILD_TARGETS }}" @@ -140,7 +159,7 @@ jobs: . setenv.sh make -j$(getconf _NPROCESSORS_ONLN) ${{ env.BUILD_TARGETS }} - name: 'Configure OpenDDS (windows)' - if: ${{ matrix.m.os == 'windows-2022' }} + if: ${{ matrix.m.os == 'windows-2022' && steps.cache-opendds.outputs.cache-hit != 'true' }} shell: cmd run: |- echo "dds_security=${{ matrix.m.dds_security }}; CONFIG_OPTIONS=${{ env.CONFIG_OPTIONS }}; BUILD_TARGETS=${{ env.BUILD_TARGETS }}" @@ -148,14 +167,14 @@ jobs: configure --no-tests ${{ env.CONFIG_OPTIONS }} perl tools/scripts/show_build_config.pl - name: 'Build OpenDDS (windows)' - if: ${{ matrix.m.os == 'windows-2022' }} + if: ${{ matrix.m.os == 'windows-2022' && steps.cache-opendds.outputs.cache-hit != 'true' }} shell: cmd run: |- cd OpenDDS call setenv.cmd msbuild -p:Configuration=Debug,Platform=x64 -t:${{ env.BUILD_TARGETS }} -m DDS_TAOv2.sln - name: 'Install (ubuntu / macos)' - if: ${{ matrix.m.os == 'ubuntu-22.04' || matrix.m.os == 'macos-13' }} + if: ${{ matrix.m.os == 'ubuntu-22.04' || matrix.m.os == 'macos-14' }} shell: bash run: |- npm install @@ -176,12 +195,12 @@ jobs: echo Core file pattern set to: cat /proc/sys/kernel/core_pattern - name: 'Change Cores Directory Permissions (macos)' - if: ${{ matrix.m.os == 'macos-13' }} + if: ${{ matrix.m.os == 'macos-14' }} shell: bash run: | sudo chmod o+w /cores - name: 'Test (ubuntu / macos)' - if: ${{ matrix.m.os == 'ubuntu-22.04' || matrix.m.os == 'macos-13' }} + if: ${{ matrix.m.os == 'ubuntu-22.04' || matrix.m.os == 'macos-14' }} shell: bash run: |- ulimit -c unlimited @@ -193,7 +212,7 @@ jobs: ./run_test.pl node2cpp --rtps ./run_test.pl node2node --rtps - name: 'Test Secure (ubuntu / macos)' - if: ${{ (matrix.m.os == 'ubuntu-22.04' || matrix.m.os == 'macos-13') && matrix.m.dds_security == 1 }} + if: ${{ (matrix.m.os == 'ubuntu-22.04' || matrix.m.os == 'macos-14') && matrix.m.dds_security == 1 }} shell: bash run: |- ulimit -c unlimited diff --git a/README.md b/README.md index 65ec7cd..1862898 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,25 @@ * If using security, you may need to ensure that OpenDDS is built with the same version of OpenSSL used by Node.js ## Tested platforms: -* Node LTS versions 8, 10, 12, 14, 16, 18, 20 +* Node LTS versions 18, 20, 22, 24 * Linux (Ubuntu 20.04) x86_64 using gcc 9.4.0 * Linux (Ubuntu 22.04) x86_64 using gcc 11.2.0 (w/ openssl-1.1.1q) * Windows (Server 2022) x86_64 using Visual Studio Enterprise 2022 * macOS (11.7) x86_54 using clang 13.0 * Other OpenDDS-supported platforms should work, but may required changes to binding.gyp +## Quality of Service (QoS) +When passing QoS objects to entities, note that fields defined as sequences (like `representation`) must be passed as arrays, even if they only contain a single value. For example, to set the `representation` QoS for a DataWriter, the property should be structured like this: + +```javascript +let qos = { + // ... other QoS settings + representation: { + value: ["DDS::XCDR_DATA_REPRESENTATION"] + } +}; +``` + ## Building and running the tests * In OpenDDS directory: ``` @@ -40,6 +52,12 @@ $ node-gyp configure build ## Changelog +### Version 0.3.1 + +* Added support for Node.js 22 and 24 (Updated `nan` dependency) +* Fixed an issue where invalid-data callbacks included misleading sample payloads +* Implemented map types in `ValueReader` and `ValueWriter` to satisfy updated OpenDDS interfaces + ### Version 0.3.0 * Update NodeValueWriter and NodeValueReader accordingly to the ValueWriter and ValueReader changes in OpenDDS 3.28.0 diff --git a/package-lock.json b/package-lock.json index 022600d..155246f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,21 +10,21 @@ "hasInstallScript": true, "license": "BSD-3-Clause", "dependencies": { - "nan": "^2.19.0" + "nan": "^2.26.2" } }, "node_modules/nan": { - "version": "2.22.1", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.22.1.tgz", - "integrity": "sha512-pfRR4ZcNTSm2ZFHaztuvbICf+hyiG6ecA06SfAxoPmuHjvMu0KUIae7Y8GyVkbBqeEIidsmXeYooWIX9+qjfRQ==", + "version": "2.26.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.26.2.tgz", + "integrity": "sha512-0tTvBTYkt3tdGw22nrAy50x7gpbGCCFH3AFcyS5WiUu7Eu4vWlri1woE6qHBSfy11vksDqkiwjOnlR7WV8G1Hw==", "license": "MIT" } }, "dependencies": { "nan": { - "version": "2.22.1", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.22.1.tgz", - "integrity": "sha512-pfRR4ZcNTSm2ZFHaztuvbICf+hyiG6ecA06SfAxoPmuHjvMu0KUIae7Y8GyVkbBqeEIidsmXeYooWIX9+qjfRQ==" + "version": "2.26.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.26.2.tgz", + "integrity": "sha512-0tTvBTYkt3tdGw22nrAy50x7gpbGCCFH3AFcyS5WiUu7Eu4vWlri1woE6qHBSfy11vksDqkiwjOnlR7WV8G1Hw==" } } } diff --git a/package.json b/package.json index e8ed841..e6ad91c 100755 --- a/package.json +++ b/package.json @@ -28,6 +28,6 @@ "license": "BSD-3-Clause", "gypfile": true, "dependencies": { - "nan": "^2.19.0" + "nan": "^2.26.2" } } diff --git a/src/NodeValueReader.cpp b/src/NodeValueReader.cpp index 8cf15dc..56a0dcc 100644 --- a/src/NodeValueReader.cpp +++ b/src/NodeValueReader.cpp @@ -191,6 +191,36 @@ bool NodeValueReader::end_element() return true; } +bool NodeValueReader::begin_map(OpenDDS::XTypes::TypeKind /*key_kind*/, OpenDDS::XTypes::TypeKind /*value_kind*/) +{ + return false; +} + +bool NodeValueReader::end_map() +{ + return false; +} + +bool NodeValueReader::begin_key() +{ + return false; +} + +bool NodeValueReader::end_key() +{ + return false; +} + +bool NodeValueReader::begin_value() +{ + return false; +} + +bool NodeValueReader::end_value() +{ + return false; +} + bool NodeValueReader::read_boolean(ACE_CDR::Boolean& value) { return primitive_helper(value, &v8::Value::IsBoolean); diff --git a/src/NodeValueReader.h b/src/NodeValueReader.h index 55cbafa..bad4f97 100644 --- a/src/NodeValueReader.h +++ b/src/NodeValueReader.h @@ -49,6 +49,13 @@ class NodeValueReader : public OpenDDS::DCPS::ValueReader { bool begin_element(); bool end_element(); + bool begin_map(OpenDDS::XTypes::TypeKind key_kind, OpenDDS::XTypes::TypeKind value_kind); + bool end_map(); + bool begin_key(); + bool end_key(); + bool begin_value(); + bool end_value(); + bool read_boolean(ACE_CDR::Boolean& value); bool read_byte(ACE_CDR::Octet& value); #if OPENDDS_HAS_EXPLICIT_INTS diff --git a/src/NodeValueWriter.cpp b/src/NodeValueWriter.cpp index 2831409..22359b9 100644 --- a/src/NodeValueWriter.cpp +++ b/src/NodeValueWriter.cpp @@ -121,6 +121,36 @@ bool NodeValueWriter::end_element() return true; } +bool NodeValueWriter::begin_map(OpenDDS::XTypes::TypeKind /*key_kind*/, OpenDDS::XTypes::TypeKind /*value_kind*/) +{ + return false; +} + +bool NodeValueWriter::end_map() +{ + return false; +} + +bool NodeValueWriter::begin_key() +{ + return false; +} + +bool NodeValueWriter::end_key() +{ + return false; +} + +bool NodeValueWriter::begin_value() +{ + return false; +} + +bool NodeValueWriter::end_value() +{ + return false; +} + bool NodeValueWriter::write_boolean(ACE_CDR::Boolean value) { return primitive_helper(value); diff --git a/src/NodeValueWriter.h b/src/NodeValueWriter.h index 79828e2..7639224 100644 --- a/src/NodeValueWriter.h +++ b/src/NodeValueWriter.h @@ -36,6 +36,13 @@ class NodeValueWriter : public OpenDDS::DCPS::ValueWriter { bool begin_element(ACE_CDR::ULong idx); bool end_element(); + bool begin_map(OpenDDS::XTypes::TypeKind key_kind, OpenDDS::XTypes::TypeKind value_kind); + bool end_map(); + bool begin_key(); + bool end_key(); + bool begin_value(); + bool end_value(); + bool write_boolean(ACE_CDR::Boolean value); bool write_byte(ACE_CDR::Octet value); #if OPENDDS_HAS_EXPLICIT_INTS