rclnodejs 1.6.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +2 -0
- package/index.js +152 -0
- package/lib/action/client.js +109 -10
- package/lib/action/deferred.js +8 -2
- package/lib/action/server.js +10 -1
- package/lib/action/uuid.js +4 -1
- package/lib/client.js +218 -4
- package/lib/clock.js +182 -1
- package/lib/clock_change.js +49 -0
- package/lib/clock_event.js +88 -0
- package/lib/context.js +12 -2
- package/lib/duration.js +37 -12
- package/lib/errors.js +621 -0
- package/lib/event_handler.js +21 -4
- package/lib/interface_loader.js +52 -12
- package/lib/lifecycle.js +8 -2
- package/lib/logging.js +90 -3
- package/lib/message_introspector.js +123 -0
- package/lib/message_serialization.js +10 -2
- package/lib/message_validation.js +512 -0
- package/lib/native_loader.js +9 -4
- package/lib/node.js +403 -50
- package/lib/node_options.js +40 -1
- package/lib/observable_subscription.js +105 -0
- package/lib/parameter.js +172 -35
- package/lib/parameter_client.js +506 -0
- package/lib/parameter_watcher.js +309 -0
- package/lib/publisher.js +56 -1
- package/lib/qos.js +79 -5
- package/lib/rate.js +6 -1
- package/lib/serialization.js +7 -2
- package/lib/subscription.js +8 -0
- package/lib/time.js +136 -21
- package/lib/time_source.js +13 -4
- package/lib/timer.js +42 -0
- package/lib/utils.js +27 -1
- package/lib/validator.js +74 -19
- package/package.json +4 -2
- package/prebuilds/linux-arm64/humble-jammy-arm64-rclnodejs.node +0 -0
- package/prebuilds/linux-arm64/jazzy-noble-arm64-rclnodejs.node +0 -0
- package/prebuilds/linux-arm64/kilted-noble-arm64-rclnodejs.node +0 -0
- package/prebuilds/linux-x64/humble-jammy-x64-rclnodejs.node +0 -0
- package/prebuilds/linux-x64/jazzy-noble-x64-rclnodejs.node +0 -0
- package/prebuilds/linux-x64/kilted-noble-x64-rclnodejs.node +0 -0
- package/rosidl_gen/message_translator.js +0 -61
- package/scripts/config.js +1 -0
- package/src/addon.cpp +2 -0
- package/src/clock_event.cpp +268 -0
- package/src/clock_event.hpp +62 -0
- package/src/macros.h +2 -4
- package/src/rcl_action_server_bindings.cpp +21 -3
- package/src/rcl_bindings.cpp +59 -0
- package/src/rcl_context_bindings.cpp +5 -0
- package/src/rcl_graph_bindings.cpp +73 -0
- package/src/rcl_logging_bindings.cpp +158 -0
- package/src/rcl_node_bindings.cpp +14 -2
- package/src/rcl_publisher_bindings.cpp +12 -0
- package/src/rcl_service_bindings.cpp +7 -6
- package/src/rcl_subscription_bindings.cpp +51 -14
- package/src/rcl_time_point_bindings.cpp +135 -0
- package/src/rcl_timer_bindings.cpp +140 -0
- package/src/rcl_utilities.cpp +103 -2
- package/src/rcl_utilities.h +7 -1
- package/types/action_client.d.ts +27 -2
- package/types/base.d.ts +6 -0
- package/types/client.d.ts +65 -1
- package/types/clock.d.ts +86 -0
- package/types/clock_change.d.ts +27 -0
- package/types/clock_event.d.ts +51 -0
- package/types/errors.d.ts +496 -0
- package/types/index.d.ts +10 -0
- package/types/logging.d.ts +32 -0
- package/types/message_introspector.d.ts +75 -0
- package/types/message_validation.d.ts +183 -0
- package/types/node.d.ts +107 -0
- package/types/node_options.d.ts +13 -0
- package/types/observable_subscription.d.ts +39 -0
- package/types/parameter_client.d.ts +252 -0
- package/types/parameter_watcher.d.ts +104 -0
- package/types/publisher.d.ts +28 -1
- package/types/qos.d.ts +18 -0
- package/types/subscription.d.ts +6 -0
- package/types/timer.d.ts +18 -0
- package/types/validator.d.ts +86 -0
package/lib/duration.js
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
'use strict';
|
|
16
16
|
|
|
17
17
|
const rclnodejs = require('./native_loader.js');
|
|
18
|
+
const { TypeValidationError, RangeValidationError } = require('./errors.js');
|
|
18
19
|
const S_TO_NS = 10n ** 9n;
|
|
19
20
|
|
|
20
21
|
/**
|
|
@@ -29,17 +30,31 @@ class Duration {
|
|
|
29
30
|
*/
|
|
30
31
|
constructor(seconds = 0n, nanoseconds = 0n) {
|
|
31
32
|
if (typeof seconds !== 'bigint') {
|
|
32
|
-
throw new
|
|
33
|
+
throw new TypeValidationError('seconds', seconds, 'bigint', {
|
|
34
|
+
entityType: 'duration',
|
|
35
|
+
});
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
if (typeof nanoseconds !== 'bigint') {
|
|
36
|
-
throw new
|
|
39
|
+
throw new TypeValidationError('nanoseconds', nanoseconds, 'bigint', {
|
|
40
|
+
entityType: 'duration',
|
|
41
|
+
});
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
const total = seconds * S_TO_NS + nanoseconds;
|
|
40
45
|
if (total >= 2n ** 63n) {
|
|
41
|
-
throw new
|
|
42
|
-
'
|
|
46
|
+
throw new RangeValidationError(
|
|
47
|
+
'total nanoseconds',
|
|
48
|
+
total,
|
|
49
|
+
'< 2^63 (max C duration)',
|
|
50
|
+
{
|
|
51
|
+
entityType: 'duration',
|
|
52
|
+
details: {
|
|
53
|
+
seconds: seconds,
|
|
54
|
+
nanoseconds: nanoseconds,
|
|
55
|
+
total: total,
|
|
56
|
+
},
|
|
57
|
+
}
|
|
43
58
|
);
|
|
44
59
|
}
|
|
45
60
|
|
|
@@ -67,9 +82,9 @@ class Duration {
|
|
|
67
82
|
if (other instanceof Duration) {
|
|
68
83
|
return this._nanoseconds === other.nanoseconds;
|
|
69
84
|
}
|
|
70
|
-
throw new
|
|
71
|
-
|
|
72
|
-
);
|
|
85
|
+
throw new TypeValidationError('other', other, 'Duration', {
|
|
86
|
+
entityType: 'duration',
|
|
87
|
+
});
|
|
73
88
|
}
|
|
74
89
|
|
|
75
90
|
/**
|
|
@@ -81,7 +96,9 @@ class Duration {
|
|
|
81
96
|
if (other instanceof Duration) {
|
|
82
97
|
return this._nanoseconds !== other.nanoseconds;
|
|
83
98
|
}
|
|
84
|
-
throw new
|
|
99
|
+
throw new TypeValidationError('other', other, 'Duration', {
|
|
100
|
+
entityType: 'duration',
|
|
101
|
+
});
|
|
85
102
|
}
|
|
86
103
|
|
|
87
104
|
/**
|
|
@@ -93,7 +110,9 @@ class Duration {
|
|
|
93
110
|
if (other instanceof Duration) {
|
|
94
111
|
return this._nanoseconds < other.nanoseconds;
|
|
95
112
|
}
|
|
96
|
-
throw new
|
|
113
|
+
throw new TypeValidationError('other', other, 'Duration', {
|
|
114
|
+
entityType: 'duration',
|
|
115
|
+
});
|
|
97
116
|
}
|
|
98
117
|
|
|
99
118
|
/**
|
|
@@ -105,7 +124,9 @@ class Duration {
|
|
|
105
124
|
if (other instanceof Duration) {
|
|
106
125
|
return this._nanoseconds <= other.nanoseconds;
|
|
107
126
|
}
|
|
108
|
-
throw new
|
|
127
|
+
throw new TypeValidationError('other', other, 'Duration', {
|
|
128
|
+
entityType: 'duration',
|
|
129
|
+
});
|
|
109
130
|
}
|
|
110
131
|
|
|
111
132
|
/**
|
|
@@ -117,7 +138,9 @@ class Duration {
|
|
|
117
138
|
if (other instanceof Duration) {
|
|
118
139
|
return this._nanoseconds > other.nanoseconds;
|
|
119
140
|
}
|
|
120
|
-
throw new
|
|
141
|
+
throw new TypeValidationError('other', other, 'Duration', {
|
|
142
|
+
entityType: 'duration',
|
|
143
|
+
});
|
|
121
144
|
}
|
|
122
145
|
|
|
123
146
|
/**
|
|
@@ -129,7 +152,9 @@ class Duration {
|
|
|
129
152
|
if (other instanceof Duration) {
|
|
130
153
|
return this._nanoseconds >= other.nanoseconds;
|
|
131
154
|
}
|
|
132
|
-
throw new
|
|
155
|
+
throw new TypeValidationError('other', other, 'Duration', {
|
|
156
|
+
entityType: 'duration',
|
|
157
|
+
});
|
|
133
158
|
}
|
|
134
159
|
}
|
|
135
160
|
|