Skip to content

Commit 1ae1ba7

Browse files
CON-190, CON-191, CON-178, CON-226, CON-227, CON-184 merge to 1.2.0 (#69)
* CON-178, CON-226, CON-227, CON-184 (#59) * Release/connector/1.1.0 (#57) * Mention node.js support in getting_started.rst * Feature/con 173 node12 test (#14) * CON-173: Creating temporary remote branch for testing * CON-173: Update dependencies to RTI-managed repos * CON-173: Revert changes to connector * CON-177: Added support for sample/view/instance state (#15) * CON-177: Added support for sample/view/instance state * CON-177: PR feedback - Indicate possible values of the new fields in the docs - Use the naming conventions for strings in unit tests * CON-173: Fixed unit tests which were failing Some items had been added to a JSON object but not in the other JSON object we were checking. This ocurred when adding support for CON-177 * CON-173: Update docs so that we don't mention node 8 (#17) * CON-173: Update docs so that we don't mention node 8 * CON-173: PR feedback #time 5m Remove paragraph mentioning Node 12 incompatibility. Co-authored-by: Sam Raeburn <sam@rti.com> * Feature/con 188 (#18) * CON-188: Added docs + tests * CON-188: Revert changes to package.json * CON-188: Change of functionality Previously, any non-key fields would be returned as null when obtain via DD_GET operations. This is no longer the case. * CON-188: Remove debug * CON-188: PR feedback - doc related * CON-188: PR Feedback - Do not access non-key fields in the unit tests - Fix docs Co-authored-by: Sam Raeburn <sam@rti.com> * CON-209: Js doc update * Update README.md (#19) Fixing the link to OpenLayers * Feature/con 163 test (#23) * CON-163: Added test for CON-163 * CON-209: Added unit test for CON-209 Co-authored-by: Sam Raeburn <sam@rti.com> * CON-212: Added CONTRIBUTING.md file (#21) Co-authored-by: Sam Raeburn <sam@rti.com> * CON-214: Test for creating Connector with participant_qos (#24) Co-authored-by: Sam Raeburn <sam@rti.com> * CORE-10744: Updating docs for new system resource defaults (#26) Co-authored-by: Sam Raeburn <sam@rti.com> * CON-211: updating links to other manuals for connector-js * CON-211: in -js, updated GSG title and fixed an error in a GSG cross-reference * CON-188: Updated instance support section of features.rst (#29) Co-authored-by: Sam Raeburn <sam@rti.com> * Feature/con 173 napi (#27) * CON-173: Use 3rd-party managed *-napi packages * Update documentation * Fixed docs * Fix list * CON-173: Update packages used in code * CON_173: Correct struct package Co-authored-by: Sam Raeburn <sam@rti.com> * GREEN-1938: Use the ffi-napi modules in tests (#30) Some of the unit tests were requiring the ffi modules to test the ability to extend the API. Since we updated package.json to use the ffi-napi module, the ffi module is no longer present and these tests were failing. Co-authored-by: Sam Raeburn <sam@rti.com> * Updated documentation to explain that we do not support Node 12.19.0. (#31) Co-authored-by: Sam Raeburn <sam@rti.com> * Feature/con 217 (#33) * Fixed sockets.io example * feature/CON218: Added graph example * Updated example README Co-authored-by: Sam Raeburn <sam@rti.com> * PLATFORMS-1925. Updated supported platforms to match Hercules PAM. * Introduce EOL normalization (#32) * CON-174: Handle armv8 architectures (#37) Co-authored-by: Sam Raeburn <sam@rti.com> * CON-221: Added docs for the dynamic loading of libraries (#39) Co-authored-by: Sam Raeburn <sam@rti.com> * CORE-11069: Customer facing XML has been updated (#38) * CORE-11069: Customer facing XML has been updated * CORE-11069: Update XML used in tests Co-authored-by: Sam Raeburn <sam@rti.com> * Feature/con 220 (#34) * Updated package.json to not use asterisk for dependency versions * Committed the generated package-lock.json * Updated README containing additional dependencies to state specific version Co-authored-by: Sam Raeburn <sam@rti.com> * CON-211: removed a statement per reviewer feedback after resolving conflicts * CON-215: Added release notes (#25) * CON-215: Added release notes * CON-215: Added notes for CON-188 * CON-215: Added more issues to notes * CON-215: Added issue num * Update docs/release_notes.rst * Update docs/release_notes.rst * Apply suggestions from code review * Update docs/release_notes.rst * Update docs/release_notes.rst * CON-215: making same changes to Javascript docs as I made to Python ones, mainly for release notes * CON-215: PR feedback * PR feedback - Fix typo Co-authored-by: Sam Raeburn <sam@rti.com> Co-authored-by: rkorte <rkorte@rti.com> * restore 'LICENSE.pdf' to git from lfs * Removed the gitattributes file since it now has no use * GREEN-2058: Added tests for new functionality in DD parser (#41) Co-authored-by: Sam Raeburn <sam@rti.com> * Updated native libs * Feature/dir renames (#43) * Updating directory names when searching for native libs * - Update commit to submodule - Remove support for 32-bit windows + Linux * Update commit of native libs * Explicitly load library dependencies on Windows * Fix loading of extra libs Co-authored-by: Sam Raeburn <sam@rti.com> * Updated platforms * Removed symbol from ARMv7 platform * Updated submodule to feature/update-libs-for-internal-rel (#45) Co-authored-by: Sam Raeburn <sam@rti.com> * Feature/release notes fix (#46) * - Fixed formatting of release notes - Updated version in docs * - Added static method to Connector class providing current version. * fix typo * - Set version to 1.1.0 in docs - Remove version() functions - needs further thought on implementation - Updated docs to use RTI blue colour Co-authored-by: Sam Raeburn <sam@rti.com> * Update README in web socket example (#48) * Update README in web socket example * Fix formatting Co-authored-by: Sam Raeburn <sam@rti.com> * Added Ubuntu 16.04 to release notes (x64, Armv8) (#47) * Added Ubuntu 16.04 to release notes (x64, Armv8) * Added ARMv8 support to whats new 1.1.0 * fix typo Co-authored-by: Sam Raeburn <sam@rti.com> * Update minimum supported version of node v10 in docs (#49) Co-authored-by: Sam Raeburn <sam@rti.com> * CON-211: testing all links to core docs, fixing few that were broken - js * CON-215: added two new js release notes * CON-194: js changes: updated copyrights, added logging to match python * CON-194: Added additional setence to Managing Data Instances section. * HERCULES-186: updates to licenses doc for javascript * Add support for loading 32-bit libs if present (#54) * Add support for loading 32-bit libs if present * Update rticonnextdds-connector.js Co-authored-by: Alex Campos <alejandro@rti.com> Co-authored-by: Sam Raeburn <sam@rti.com> Co-authored-by: Alex Campos <alejandro@rti.com> * HERCULES-186: modified lua and json-parser lines for Connector js * Document dependency on Connext version from dynamic libs (#56) * Document dependency on Connext version from dynamic libs * PR feedback Clarified wording & added link * PR feedback Co-authored-by: Sam Raeburn <sam@rti.com> * Update native libraries to version 6.1.0 * Update README for version 1.1.0 * Update package.json for version 1.1.0 Co-authored-by: Alex Campos <alejandro@rti.com> Co-authored-by: Sam Raeburn <sam@rti.com> Co-authored-by: Alex Campos <alex@rti.com> Co-authored-by: Rabbi Shuki Gur <rabbishuki@users.noreply.github.com> Co-authored-by: rkorte <rkorte@rti.com> Co-authored-by: Adelle Olson <adelle@rti.com> Co-authored-by: rkorte <36715349+rkorte@users.noreply.github.com> * CON-226: Added npm scripts to package.json - Via npm it is now possible to run the tests, code coverage and linter - Fixed many lint issues CON-227: Fixed issue where a promise was never resolved - When adding tests in order to increase code coverage this issue was discovered, and fixed. The promise returned by output.wait is now correctly rejected or resolved. CON-178: Added code coverage via istanbul package - Added tests to achieve following code coverage stats: Statements : 91.33% ( 358/392 ) Branches : 81.41% ( 162/199 ) Functions : 100% ( 89/89 ) Lines : 91.33% ( 358/392 ) With the above changes we can vastly improve the CI we have. Additionally, we can now test against multiple versions of Node.JS by installing nvm on the test machines and doing: nvm install 10 nvm use 10 npm run test-ci coverage-ci lint nvm install 12 nvm use 12 npm run test-ci coverage-ci lint ... * CON-226: Fix lint error + tested all scripts * CON-184: Added pdf docs make latexpdf now generates pdf * CON-184: Fixed naming of pdf file Co-authored-by: Alex Campos <alejandro@rti.com> Co-authored-by: Sam Raeburn <sam@rti.com> Co-authored-by: Alex Campos <alex@rti.com> Co-authored-by: Rabbi Shuki Gur <rabbishuki@users.noreply.github.com> Co-authored-by: rkorte <rkorte@rti.com> Co-authored-by: Adelle Olson <adelle@rti.com> Co-authored-by: rkorte <36715349+rkorte@users.noreply.github.com> (cherry picked from commit 1d7a589) * Fixed linting problems + committed the lint config file. (#63) * Fixed linting problems + committed the lint config file. Generated the linting config file with the following configuration: sam@rti-10678:~/working/trees/connector/rticonnextdds-connector-js$ eslint --init ✔ How would you like to use ESLint? · style ✔ What type of modules does your project use? · commonjs ✔ Which framework does your project use? · none ✔ Does your project use TypeScript? · No / Yes ✔ Where does your code run? · browser ✔ How would you like to define a style for your project? · guide ✔ Which style guide do you want to follow? · standard ✔ What format do you want your config file to be in? · JSON * Fixed eslint file to state we use Node, not Browser Co-authored-by: Sam Raeburn <sam@rti.com> (cherry picked from commit 9cface5) * CON-191, CON-190 64-bit numner support (#64) * Fixed linting problems + committed the lint config file. Generated the linting config file with the following configuration: sam@rti-10678:~/working/trees/connector/rticonnextdds-connector-js$ eslint --init ✔ How would you like to use ESLint? · style ✔ What type of modules does your project use? · commonjs ✔ Which framework does your project use? · none ✔ Does your project use TypeScript? · No / Yes ✔ Where does your code run? · browser ✔ How would you like to define a style for your project? · guide ✔ Which style guide do you want to follow? · standard ✔ What format do you want your config file to be in? · JSON * Fixed eslint file to state we use Node, not Browser * CON-191: Added 64-bit number support. * CON-191: Added docs * CON-191: writers' edits to doc changes * CON-190: Fixed existing unit tests There was some left over state by the test that loads an additional API, this was causing later discovery checks to fail. Have made all tests independent. * CON-191: Extended testing to cover all use-cases Also discovered that getJSON cannot be used for large ints (and in fact is worse than getNumber since we cannot detect when it would corrupt the value). * CON-191: Finished docs * CON-191: Minor doc edit Co-authored-by: Sam Raeburn <sam@rti.com> Co-authored-by: rkorte <rkorte@rti.com> (cherry picked from commit 85c5925) * CON-92: Fix merge issue
1 parent 76c67a9 commit 1ae1ba7

18 files changed

Lines changed: 4616 additions & 1000 deletions

.eslintrc.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"env": {
3+
"node": true,
4+
"commonjs": true,
5+
"es2021": true
6+
},
7+
"extends": [
8+
"standard"
9+
],
10+
"parserOptions": {
11+
"ecmaVersion": 12
12+
},
13+
"rules": {
14+
}
15+
}

docs/conf.py

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,74 @@ def setup(app):
8383
# the docs. This file should be a Windows icon file (.ico) being 16x16 or
8484
# 32x32 pixels large.
8585
#
86-
html_favicon = "static/favicon.ico"
86+
html_favicon = "static/favicon.ico"
87+
88+
# -- Options for LaTeX output -------------------------------------------------------------------------------------------
89+
latex_engine = 'lualatex'
90+
latex_use_xindy = False
91+
92+
# latex config taken from connextdds repo
93+
latex_elements = {
94+
# The paper size ('letterpaper' or 'a4paper').
95+
'papersize': 'letterpaper',
96+
97+
# The font size ('10pt', '11pt' or '12pt')
98+
'pointsize': '11pt',
99+
'preamble': '''\
100+
\\sphinxsetup{TitleColor={named}{black},InnerLinkColor={named}{black},OuterLinkColor={named}{blue}}
101+
\\usepackage[utf8]{inputenc}
102+
\\usepackage[titles]{tocloft}
103+
\\usepackage{multirow}
104+
\\usepackage{newunicodechar}
105+
\\usepackage{hyperref}
106+
\\usepackage{fontspec}
107+
\\usepackage{graphicx}
108+
\\setkeys{Gin}{width=.85\\textwidth}
109+
\\hypersetup{bookmarksnumbered}
110+
\\setcounter{tocdepth}{3}
111+
\\usepackage{fancyhdr}
112+
\\setlength{\headheight}{14pt}
113+
\\usepackage[draft]{minted}\\fvset{breaklines=true, breakanywhere=true}''',
114+
'printindex': '\\footnotesize\\raggedright\\printindex',
115+
'inputenc': '',
116+
'utf8extra': '',
117+
'classoptions': ',openany,oneside',
118+
'releasename': 'Version',
119+
'fncychap': '',
120+
'maketitle': '''\
121+
\\pagenumbering{Roman} %%% to avoid page 1 conflict with actual page 1
122+
\\begin{titlepage}
123+
\\centering
124+
125+
\\vspace{40mm} %%% * is used to give space from top
126+
127+
\\textbf{\\Huge{''' + project + '''}}
128+
\\vspace{17mm}
129+
130+
\\textbf{\\Large{Version ''' + version + '''}}
131+
132+
\\vspace{100mm}
133+
\\vspace{0mm}
134+
\\end{titlepage}
135+
'''
136+
}
137+
138+
latex_use_modindex = True
139+
140+
# Grouping the document tree into LaTeX files. List of tuples
141+
# (source start file, target name, title,
142+
# author, documentclass [howto, manual, or own class]).
143+
latex_documents = [
144+
(
145+
master_doc,
146+
'rticonnectorforjavascript.tex',
147+
'RTI Connector for Javascript',
148+
'2021, Real-Time Innovations, Inc.',
149+
'manual'
150+
),
151+
]
152+
153+
# The name of an image file (relative to this directory) to place at the top of
154+
# the title page.
155+
#
156+
html_logo = "static/rti-logo-FINALv2-White-OrangeDot.png"

docs/copyright_license.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Website: https://support.rti.com/ |br|
104104
notice, this list of conditions and the following disclaimer in the
105105
documentation and/or other materials provided with the distribution.
106106

107-
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
107+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ''AS IS'' AND
108108
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
109109
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
110110
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE

docs/data.rst

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -129,18 +129,6 @@ To set any numeric type, including enumerations:
129129
output.instance.setNumber('my_double', 2.14)
130130
output.instance.setNumber('my_enum', 2)
131131
132-
.. warning::
133-
The range of values for a numeric field is determined by the type
134-
used to define that field in the configuration file. However,
135-
``setNumber`` and ``getNumber`` can't handle 64-bit integers
136-
(*int64* and *uint64*) whose absolute values are larger than 2^53.
137-
This is a *Connector* limitation due to the use of *double* as an
138-
intermediate representation.
139-
140-
When ``setNumber`` or ``getNumber`` detect this situation, they will raise
141-
an :class:`DDSError`. ``getJson`` and ``setJson`` do not have this
142-
limitation and can handle any 64-bit integer.
143-
144132
To set booleans:
145133

146134
.. code-block::
@@ -170,7 +158,7 @@ Similarly, to get a field in a :class:`Input` sample, use the appropriate
170158
getter: :meth:`SampleIterator.getNumber()`, :meth:`SampleIterator.getBoolean()`,
171159
:meth:`SampleIterator.getString()`, or the type-independent
172160
:meth:`SampleIterator.get()`.
173-
``getString`` also works with numeric fields, returning the number as a string:
161+
:meth:`SampleIterator.getString` also works with numeric fields, returning the number as a string:
174162

175163
.. code-block::
176164
@@ -191,17 +179,63 @@ getter: :meth:`SampleIterator.getNumber()`, :meth:`SampleIterator.getBoolean()`,
191179
192180
193181
.. note::
194-
The typed getters and setters perform better than ``set``
195-
and ``get`` in applications that write or read at high rates.
196-
Also prefer ``getJson`` and ``setFromJson`` over ``set``
197-
and ``get`` when accessing all or most of the fields of a sample
182+
The typed getters and setters perform better than :meth:`Instance.set`
183+
and :meth:`SampleIterator.get` in applications that write or read at high rates.
184+
Also, prefer :meth:`SampleIterator.getJson` and :meth:`Instance.setFromJson`
185+
over :meth:`Instance.set` and :meth:`SampleIterator.get` when accessing all
186+
or most of the fields of a sample
198187
(see previous section).
199188

200189
.. note::
201190
If a field ``my_string``, defined as a string in the configuration file, contains
202191
a value that can be interpreted as a number, ``sample.get('my_string')`` returns
203192
a number, not a string.
204193

194+
Accessing 64-bit integers
195+
^^^^^^^^^^^^^^^^^^^^^^^^^
196+
Internally, *Connector* relies on a framework that only contains a single number
197+
type, an IEEE-754 floating-point number. Additionally, *Connector* does not use
198+
JavaScript's BigInt representation for numbers, meaning JavaScript has this same limitation.
199+
As a result, not all 64-bit integers can be represented with exact precision using all
200+
APIs.
201+
If your type contains ``uint64`` or ``int64`` members, and you expect them to be larger
202+
than ``Number.MAX_SAFE_INTEGER`` (or smaller than ``Number.MIN_SAFE_INTEGER``),
203+
then you must take the following into account.
204+
205+
64-bit values with an absolute value greater or equal to 2^53 can be set via:
206+
- The type-agnostic setter, :meth:`Instance.set`. The values must be supplied
207+
as strings, e.g., ``the_output.instance.set('my_uint64', '18446744073709551615')``.
208+
- :meth:`Instance.setString`, e.g., ``the_output.instance.setString('my_uint64', '18446744073709551615')``.
209+
- :meth:`Instance.setFromJson`, if the values are provided as strings, e.g., ``the_output.instance.setFromJson({my_uint64: '18446744073709551615'})``.
210+
211+
64-bit values with an absolute value greater than 2^53 can be retrieved via:
212+
- The type-agnostic getter, :meth:`SampleIterator.get`. If the absolute value of
213+
the field is less than ``2^53`` it will be returned as a number; otherwise it will be
214+
returned as a string, e.g., ``sample.get(0).get('my_int64') // '9223372036854775807' OR 1234``.
215+
- Using :meth:`SampleIterator.getString`. The value will be returned as a string,
216+
e.g., ``sample.getString(my_int64') // '9223372036854775807' OR '1234'``.
217+
218+
.. warning::
219+
220+
If :meth:`SampleIterator.getNumber()` is used to retrieve a value > 2^53 it will
221+
throw a :class:`DDSError`.
222+
223+
.. warning::
224+
225+
If :meth:`Instance.setNumber()` is used to set a value >= 2^53 it will throw a
226+
:class:`DDSError`.
227+
228+
.. warning::
229+
230+
The :meth:`SampleIterator.getJson()` method should not be used to retrieve integer
231+
values larger than ``Number.MAX_SAFE_INTEGER`` (or smaller than ``Number.MIN_SAFE_INTEGER``).
232+
The values returned may be corrupted **but no error will be thrown**.
233+
234+
.. note::
235+
236+
The :meth:`Instance.setNumber()` operation can safely handle ``abs(value) < 2^53``,
237+
whereas the :meth:`SampleIterator.getNumber()` operation can safely handle ``abs(value) <= 2^53``.
238+
205239
Accessing structs
206240
^^^^^^^^^^^^^^^^^
207241

docs/index.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11

22
.. highlight:: javascript
33

4-
.. image:: static/RTI_Launcher_Icon_Connector_JavaScript_100x100_0919_forDocumentation.png
5-
:align: left
4+
.. only:: html
5+
6+
.. image:: static/RTI_Launcher_Icon_Connector_JavaScript_100x100_0919_forDocumentation.png
7+
:align: left
68

79
Welcome to RTI Connector for JavaScript!
810
========================================
@@ -19,9 +21,6 @@ You can learn how to use *RTI Connector* by reading the following sections, whic
1921
include examples and detailed API reference. You can also find a specific type
2022
or function in the :ref:`genindex`.
2123

22-
Table of Contents
23-
=================
24-
2524
.. toctree::
2625
:maxdepth: 2
2726
:numbered:

0 commit comments

Comments
 (0)